一、准备
[root@333fc545a958 ~]# uname -r
3.10.0-514.el7.x86_64
[root@333fc545a958 ~]# cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core)
[root@333fc545a958 ~]# groupadd www
[root@333fc545a958 ~]# useradd -s /sbin/nologin -g www www
[root@333fc545a958 ~]# yum install -y gcc make libxml2-devel openssl-devel libjpeg-devel libpng-devel freetype-devel libicu-devel gcc-c++ libxslt-devel
[root@333fc545a958 ~]# cd /home/www
[root@333fc545a958 www]# wget https://curl.haxx.se/download/curl-7.20.0.tar.gz
[root@333fc545a958 www]# tar -xzvf curl-7.20.0.tar.gz
二、安装
[root@333fc545a958 ~]# wget http://cn2.php.net/get/php-7.2.7.tar.gz/from/this/mirror
[root@333fc545a958 ~]# tar -xvf php-7.2.7.tar.gz
[root@333fc545a958 ~]# cd php-7.2.7
[root@333fc545a958 php-7.2.7]# ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc -with-config-file-scan-dir=/usr/local/php/etc/php-fpm.d --enable-fpm --with-fpm-user=www --with-fpm-group=www --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-iconv-dir --with-freetype-dir=/usr/local/freetype --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-mbregex --enable-mbstring --enable-intl --enable-ftp --with-gd --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --with-gettext --disable-fileinfo --enable-opcache --with-xsl --with-curl=/home/www/curl-7.20.0
[root@333fc545a958 php-7.2.7]# make && make install
[root@333fc545a958 php-7.2.7]# cp sapi/fpm/www.conf /usr/local/php/etc/php-fpm.d/www.conf
[root@333fc545a958 php-7.2.7]# cp sapi/fpm/php-fpm.conf /usr/local/php/etc/
[root@333fc545a958 php-7.2.7]# cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
[root@333fc545a958 php-7.2.7]# chmod +x /etc/init.d/php-fpm
[root@333fc545a958 php-7.2.7]# /etc/init.d/php-fpm start