目录
一、PHP源码编译
1、安装php
实验环境:已经安装nginx的虚拟机(安装nginx可跳转到我的另一篇博客nginx源码编译)
php下载地址:链接:https://pan.baidu.com/s/15TnjOVKv1RNISIgJpFOOcA
提取码:on3t
oniguruma-devel-6.8.2-1.el7.x86_64.rpm
http://www6.atomicorp.com/channels/atomic/centos/7/x86_64/RPMS/oniguruma-devel-6.8.2-1.el7.x86_64.rpm
oniguruma-6.8.2-1.el7.x86_64.rpm
http://www6.atomicorp.com/channels/atomic/centos/7/x86_64/RPMS/oniguruma-6.8.2-1.el7.x86_64.rpm
tar jxf php-7.4.12.tar.bz2
cd php-7.4.12/
./configure --prefix=/usr/local/lnmp/php --with-config-file-path=/usr/local/lnmp/php/etc --enable-fpm --with-fpm-user=nginx --with-fpm-group=nginx --with-curl --with-iconv --with-mhash --with-zlib --with-openssl --enable-mysqlnd --with-mysqli --with-pdo-mysql --disable-debug --enable-sockets --enable-soap --enable-inline-optimization --enable-xml --enable-ftp --enable-gd --enable-exif --enable-mbstring --enable-bcmath --with-fpm-systemd #报错显示缺少安装包
yum install libxml2-devel.x86_64 y#安装缺少的包后重新配置
yum install sqlite-devel.x86_64 -y
yum install libcurl-devel.x86_64 -y
yum install -y systemd-devel -y
yum install libpng-devel.x86_64 -y
wget http://www6.atomicorp.com/channels/atomic/centos/7/x86_64/RPMS/oniguruma-devel-6.8.2-1.el7.x86_64.rpm
wget http://www6.atomicorp.com/channels/atomic/centos/7/x86_64/RPMS/oniguruma-6.8.2-1.el7.x86_64.rpm
wget http://mirror.centos.org/centos/7/os/x86_64/Packages/systemd-libs-219-78.el7.x86_64.rpm
yum install oniguruma-6.8.2-1.el7.x86_64.rpm -y
yum install oniguruma-devel-6.8.2-1.el7.x86_64.rpm -y
./configure --prefix=/usr/local/lnmp/php --with-config-file-path=/usr/local/lnmp/php/etc --enable-fpm --with-fpm-user=nginx --with-fpm-group=nginx --with-curl --with-iconv --with-mhash --with-zlib --with-openssl --enable-mysqlnd --with-mysqli --with-pdo-mysql --disable-debug --enable-sockets --enable-soap --enable-inline-optimization --enable-xml --enable-ftp --enable-gd --enable-exif --enable-mbstring --enable-bcmath --with-fpm-systemd
#重新编译成功
php安装完成
make#编译
make install#安装
make成功
make install成功
2、修改php-fpm配置文件
cd /usr/local/lnmp/php/etc/#进入php的安装路径
ls--->php-fpm.conf.default php-fpm.d
cp php-fpm.conf.default php-fpm.conf
vim php-fpm.conf
---------------------------
13 [global]
14 ; Pid file
15 ; Note: the default prefix is /usr/local/lnmp/php/var
16 ; Default Value: none
17 pid = run/php-fpm.pid#取消注释
---------------------------
cp php.ini-production /usr/local/lnmp/php/etc/php.ini
cp sapi/fpm/php-fpm.service /usr/lib/systemd/system/
cp sapi/fpm/php-fpm.conf /usr/local/lnmp/php/etc/
cp: overwrite ‘/usr/local/lnmp/php/etc/php-fpm.conf’? y
cp sapi/fpm/www.conf /usr/local/lnmp/php/etc/php-fpm.d/
[root@server1 php-7.4.12]# cd /usr/local/lnmp/php/etc/
[root@server1 etc]# ls
php-fpm.conf php-fpm.conf.default php-fpm.d php.ini
[root@server1 etc]# vim php.ini #设置时区为亚洲上海
cd