1.安装依赖包
yum -y install autoconf freetype gd libpng libpng-devel libjpeg libxml2 libxml2-devel zlib curl curl-devel net-snmp-devel libjpeg-devel php-ldap openldap-devel openldap-clients freetype-devel gmp-devel libzip libzip-devel
2. 解压
tar xzf php-7.3.10.tar.gz
3. 编译
cd php-7.3.10/
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysqli --with-pdo-mysql --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-curl --with-gd --with-gmp --with-zlib --with-xmlrpc --with-openssl --without-pear --with-snmp --with-gettext --with-mhash --with-libxml-dir=/usr --with-fpm-user=nginx --with-fpm-group=nginx --enable-xml --enable-fpm --enable-ftp --enable-bcmath --enable-soap --enable-shmop --enable-sysvsem --enable-sockets --enable-inline-optimization --enable-maintainer-zts --enable-mbregex --enable-mbstring --enable-pcntl --disable-fileinfo --disable-rpath --enable-libxml --enable-opcache --enable-mysqlnd
4.执行安装
make && make install
3.修改配置文件
3.1 创建php.ini文件
cp /usr/local/src/php-7.3.10/php.ini-development /usr/local/php/etc/php.ini
3.2 修改conf配置文件
在 /usr/local/php/etc/ 下面复制 php-fpm.conf.default:php-fpm.conf
cp php-fpm.conf.default php-fpm.conf
查看php-fpm.conf 发现 include=/usr/local/php/etc/php-fpm.d/*.conf 引入包含文件是*.conf 的文件,所以需要复制 www.conf.default:www.conf
4.配置文件语法检测
/usr/local/php/sbin/php-fpm -t
5.服务管理
1)启动
/usr/local/php/sbin/php-fpm
2)关闭
pkill php-fpm
3)重载
pkill -USR2 php-fpm
4)查看
pstree |grep php
6.开机启动
vi /etc/rc.local
/usr/local/php/sbin/php-fpm