php7.4编译(centos)

1 下载包放到家目录

[ ~]# ls
php-7.4.0.tar.xz

2 解压并安装编译需要的工具
[ ~]# yum install gcc pcre-devel openssl-devel expat-devel autoconf libtool gcc-c++ libsqlite3x-devel (后面编译差什么包就 yum install XXX-devel -y)

3 解压进到目录
[ ~]# tar xf php-7.4.0.tar.xz
[ ~]# cd php-7.4.0
[ ~]# ./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~~~
[ ~]# make && make install

5 配置环境和文件
[ ~]# cd /data/php/etc/php-fpm.d/
[ php-fpm.d]# cp www.conf.default www.conf
[ php-fpm.d]# cp /root/php7.4.0/php.ini-development /data/php/etc/php.ini
[ php-fpm.d]# cd ..
[ etc]# ls
php-fpm.conf.default php-fpm.d php.ini
[ etc]# cp php-fpm.conf.default php-fpm.conf
[ etc]# useradd -r -s /sbin/nologin -u 1001 www
[ etc]# vim php-fpm.d/www.conf (更改启动用户 user group)
[ etc]# cd../sbin
[ sbin]# ./php-fpm

6 查看运行
[ 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

相关推荐