php-源码编译安装7
php-源码编译安装7
依赖包下载地址
http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
http://iweb.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz
http://iweb.dl.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz
yum 依赖包
yum -y install php-mcrypt libmcrypt libmcrypt-devel php-pear libxml2 libxml2-devel curl curl-devel libjpeg libjpeg-devel libpng libpng-devel freetype-devel xslt libxslt libxslt-devel
解压安装包
tar -zxvf php-7.2.20.tar.gz -C /usr/local/src
cd /usr/local/src/php-7.2.20/
编译
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/ --enable-fpm --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-iconv-dir --with-freetype-dir --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 --with-curl --enable-mbregex --enable-mbstring --with-mcrypt --enable-ftp --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --disable-fileinfo --enable-maintainer-zts
安装
make -j 4 && make install
cp /usr/local/src/php-7.2.20/php.ini-production /usr/local/php/php.ini
cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.conf
修改配置 文件
PHP-FPM启动脚本
修改 /usr/local/php/etc/php-fpm.conf 运行用户和组改为nginx
vim /usr/local/php/etc/php-fpm.conf
改:23 user = nobody:
为:23 user = nginx
改:24 group = nobody
为:24 group = nginx
[root@k10 php-7.2.20]# cp /usr/local/src/php-7.2.20/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
[root@k10 php-7.2.20]# chmod +x /etc/init.d/php-fpm
[root@k10 php-7.2.20]# chkconfig php-fpm on
[root@k10 php-7.2.20]# /etc/init.d/php-fpm start
测试是否启动
[root@k10 php-7.2.20]#netstat -antup | grep php-fpm
PHP探针文件写 入,测试是否可以打开网页
[root@k10 php-7.2.20]#echo "<?php phpinfo(); ?>" > /usr/local/nginx/html/index.php
浏览器访问:http://192.168.1.10/index.php