PHP安装教程参考:https://www.cnblogs.com/kyuang/p/6801942.html
1、安装基础环境:
yum install gcc libxml2 libxml2-devel
安装(下载地址:https://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/)
快速部署安装:(安装位置:/usr/local/libmcrypt)
cd /usr/local && wget https://nchc.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && tar -zxvf libmcrypt-2.5.8.tar.gz && cd libmcrypt-2.5.8/ && ./configure --prefix=/usr/local/libmcrypt && make && make install && cd .. && rm -rf libmcrypt-2.5.8 && rm -rf libmcrypt-2.5.8.tar.gz
3、安装php(下载地址:https://www.php.net/downloads.php)(安装位置:/usr/local/php)
cd /usr/local/ && wget https://www.php.net/distributions/php-7.4.30.tar.gz && tar -zxvf php-7.4.30.tar.gz && cd /usr/local/php-7.4.30 && ./configure -disable-fileinfo --with-apxs2=/usr/local/apache2/bin/apxs --prefix=/usr/local/php --with-curl --with-mysqli --with-openssl --with-pdo-mysql --enable-fpm && make && make install
4、为php提供配置文件(在安装目录下拷贝配置文件放到:/usr/local/php/etc/)
cp /usr/local/php-7.4.30/php.ini-production /usr/local/php/etc/php.ini
5、为php-fpm提供配置文件
创建www用户,已有忽略:groupadd www && useradd -g www www
配置文件修改:(存放位置:/usr/local/php/etc/)
cd /usr/local/php/etc && cp php-fpm.conf.default php-fpm.conf && vim php-fpm.conf
在;pid = run/php-fpm.pid下方添加或解掉注释修改为:
pid = /usr/local/php/var/run/php-fpm.pid
cd /usr/local/php/etc/php-fpm.d && cp -r www.conf.default www.conf && vim www.conf
修改子配置内容:(目录在:/usr/local/php/etc/php-fpm.d/)
user = www #启动进程的帐户和组
group = www #启动进程的帐户和组
#测试php-fpm配置
/usr/local/php/sbin/php-fpm -t
/usr/local/php/sbin/php-fpm -c /usr/local/php/etc/php.ini -y /usr/local/php/etc/php-fpm.conf -t
#启动php-fpm
/usr/local/php/sbin/php-fpm
/usr/local/php/sbin/php-fpm -c /usr/local/php/etc/php.ini -y /usr/local/php/etc/php-fpm.conf
#查看php-fpm运行状态
ps -A | grep php-fpm
#查看9000端口占用情况
netstat -tunlp | grep 9000
延伸教程“通过启动脚本控制PHP-FPM开关”:(貌似能开不能关?
标签:www,fpm,usr,&&,apache,php,local,搭建 From: https://www.cnblogs.com/brad93/p/16718427.html