1.安装php需要的扩展
1 # yum install libxml2 libxml2-devel openssl openssl-devel libcurl libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libmcrypt libmcrypt-devel -y
2.php7.2源码包下载
1 # wget http://cn2.php.net/distributions/php-7.2.0.tar.gz
3.解压并进入目录
1 # tar -zxvf php-7.2.0.tar.gz2 # cd php-7.2.0
4.开始进行配置
# ./configure --prefix=/usr/local/php720--with-mysqli --with-pdo-mysql --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir \ --with-zlib --with-libxml-dir --enable-simplexml --enable-xml --disable-rpath --enable-bcmath --enable-soap --enable-zip --with-curl --enable-fpm \ --with-fpm-user=www --with-fpm-group=www --enable-mbstring --enable-sockets --with-gd --with-openssl --with-mhash --enable-opcache \
5.编译安装
1 # make && make install
6.设置PHP7的配置文件
1 # cp /usr/local/php7/etc/php-fpm.conf.default /usr/local/php7/etc/php-fpm.conf2 # cp /usr/local/php7/etc/php-fpm.d/www.conf.default /usr/local/php7/etc/php-fpm.d/www.conf
7.启动php-fpm
1 # /usr/local/php7/sbin/php-fpm
8.配置nginx+php-fpm
# vim /usr/local/nginx/conf/nginx.conf
9.重新加载nginx.conf
1 # /usr/local/nginx/sbin/nginx -s reload