1. 源码包下载地址
https://pan.baidu.com/s/1bpi4D9l
2. 解压php压缩包:
tar -xzvf php-7.2.0.tar.gz
3.进入解压后的
cd php7.2.0
4.安装php需要的扩展
yum -y install libxml2 libxml2-devel openssl openssl-devel libcurl libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libmcrypt libmcrypt-devel
6.开始进行配置
./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=nobody --with-fpm-group=nobody --enable-mbstring --enable-sockets --with-gd --with-openssl --with-mhash --enable-opcache --disable-fileinfo
7.编译安装
make && make install
8. 配置nginx.conf支持解析PHP
-
cd /usr/local/php720/etc
-
cp php-fpm.conf.default php-fpm.conf
/usr/local/php720/sbin/php-fpm
-
cd /usr/local/php720/etc/php-fpm.d
-
cp www.conf.default www.conf
pkill php-fpm
/usr/local/php720/sbin/php-fpm
[Unit]
Description=The PHP FastCGI Process Manager
After=syslog.target network.target
[Service]
Type=simple
PIDFile=/run/php-fpm.pid
ExecStart=/usr/local/php720/sbin/php-fpm --nodaemonize --fpm-config /usr/local/php720/etc/php-fpm.conf
ExecReload=/bin/kill -USR2 $MAINPID
ExecStop=/bin/kill -SIGINT $MAINPID
[Install]
WantedBy=multi-user.target