本文将介绍如何在CentOS7服务器上使用yum命令安装PHP7.2。内容摘自外文网站,点击查看原文。安装PHP7.2安装EPEL包:$sudoyuminstallepel-release安装remi源:$sudoyuminstallhttp://rpms.remirepo.net/enterprise/remi-release-7.rpm安装yum扩展包:$sudoyum安装yum-utils启用remi存储库:$sudoyum-config-manager--enableremi-php72$sudoyumupdate安装PHP7.2$sudoyuminstallphp72安装php-fpm和一些其他模块$sudoyuminstallphp72-php-fpmphp72-php-gdphp72-php-jsonphp72-php-mbstringphp72-php-mysqlndphp72-php-xmlphp72-php-xmlrpcphp72-php-opcache输入php72-v查看安装结果php-fpm服务设置bootSelf-start$sudosystemctlenablephp72-php-fpm.servicecommonphp-fpm命令#打开服务$sudosystemctlstartphp72-php-fpm.service#停止服务$sudosystemctlstopphp72-php-fpm.service#查看状态$sudosystemctlstatusphp72-php-fpm.service通过egrep查询nginx服务器的用户和用户组:$egrep'^(user|group)'/etc/nginx/nginx.conf结果示例:usernginx;编辑/etc/opt/remi/php72/php-fpm.d/www.conf,修改php-fpm的执行权限:$sudovi/etc/opt/remi/php72/php-fpm.d/www.conf将用户和用户组设置为nginx:使用r=nginxgroup=nginx保存并关闭文件,重启php-fpm服务:$sudosystemctlrestartphp72-php-fpm.service路径安排#php安装路径/etc/opt/remi/php72#nginx配置文件/etc/nginx/nginx.conf#nginx默认项目路径/usr/share/nginx/html
