因不同版本间存在少许差异,先说明环境版本:Centos7.8、Apache2.4、PHP7.3,亲测成功
参考安装:https://blog.csdn.net/qq_35145723/article/details/109811593
参考配置:https://blog.csdn.net/heyong_2016/article/details/108471032
1. Apache安装
yum install httpd
2. Apache配置
systemctl enable httpd
3. PHP依赖包、程序包、扩展包
yum install epel-release
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum install yum-utils
yum install -y php73-php-fpm php73-php-cli php73-php-bcmath php73-php-gd php73-php-json php73-php-mbstring php73-php-mcrypt php73-php-mysqlnd php73-php-opcache php73-php-pdo php73-php-pecl-crypto php73-php-pecl-mcrypt php73-php-pecl-geoip php73-php-recode php73-php-snmp php73-php-soap php73-php-xml php73-php-zip php73-php-xml* php73-php-phpiredis php73-php-pecl-redis5.x86_64
4. 完成后查看PHP版本
php73 -v
5. PHP自启和启动
systemctl enable php73-php-fpm systemctl start php73-php-fpm
6. 在Apache网站目录建立index.php文件,一般情况下网站目录在/var/www/html
<?php phpinfo(); ?>
7. 浏览器如无法解析PHP文件,则继续配置
8. 确认配置文件/etc/opt/remi/php73/php-fpm.d/www.conf中,参数listen = 127.0.0.1:9000,如不同请修改
9. 创建文件
vim /etc/httpd/conf.modules.d/10-php-fpm.conf
10. 文件内容如下
<FilesMatch \.php$> SetHandler "proxy:fcgi://127.0.0.1:9000" </FilesMatch>
11. 重启服务
systemctl restart php73-php-fpm systemctl restart httpd
附录:
PHP配置文件中几处可能需要修改的参数
vim /etc/opt/remi/php73/php.ini
修改参数内容
memory_limit = 512M post_max_size = 512M upload_max_filesize = 100M max_execution_time = 300 max_input_time = 300 date.timezone = Asia/Shanghai max_input_vars = 10000
标签:PHP,fpm,php73,php7.3,Centos7,systemctl,yum,php From: https://www.cnblogs.com/thinkboy/p/16884481.html