1 下载包放到家目录
[root@centos ~]# ls
php-7.4.0.tar.xz
2 解压并安装编译需要的工具
[root@centos ~]# yum install gcc pcre-devel openssl-devel expat-devel autoconf libtool gcc-c++ libsqlite3x-devel (后面编译差什么包就 yum install XXX-devel -y)
3 解压进到目录
[root@centos ~]# tar xf php-7.4.0.tar.xz
[root@centos ~]# cd php-7.4.0
[root@centos ~]# ./configure --prefix=/data/php --enable-fpm --with-fpm-user=www
--with-fpm-group=www --with-pear --with-curl --with-png-dir --with-freetype-dir --
with-iconv --with-mhash --with-zlib --with-xmlrpc --with-xsl --with-openssl --
with-mysqli --with-pdo-mysql --disable-debug --enable-zip --enable-sockets --enablesoap
--enable-inline-optimization --enable-xml --enable-ftp --enable-exif --enablewddx
--enable-bcmath --enable-calendar --enable-shmop --enable-dba --enable-sysvsem -
-enable-sysvshm --enable-sysvmsg
4 make~~~
[root@centos ~]# make && make install
5 配置环境和文件
[root@centos ~]# cd /data/php/etc/php-fpm.d/
[root@centos php-fpm.d]# cp www.conf.default www.conf
[root@centos php-fpm.d]# cp /root/php7.4.0/php.ini-development /data/php/etc/php.ini
[root@centos php-fpm.d]# cd ..
[root@centos etc]# ls
php-fpm.conf.default php-fpm.d php.ini
[root@centos etc]# cp php-fpm.conf.default php-fpm.conf
[root@centos etc]# useradd -r -s /sbin/nologin -u 1001 www
[root@centos etc]# vim php-fpm.d/www.conf (更改启动用户 user group)
[root@centos etc]# cd../sbin
[root@centos sbin]# ./php-fpm
6 查看运行
[root@centos sbin]# ps -ef | grep www
www 28944 28943 0 18:27 ? 00:00:00 php-fpm: pool www
www 28945 28943 0 18:27 ? 00:00:00 php-fpm: pool www