1.檢查安裝環境刪除5.4.16版本的php
rpm -qa|grep php
php-pdo-5.4.16-46.el7.x86_64
php-cli-5.4.16-46.el7.x86_64
php-ldap-5.4.16-46.el7.x86_64
php-mbstring-5.4.16-46.el7.x86_64
php-5.4.16-46.el7.x86_64
php-xml-5.4.16-46.el7.x86_64
php-mysql-5.4.16-46.el7.x86_64
php-common-5.4.16-46.el7.x86_64
php-fpm-5.4.16-46.el7.x86_64
php-bcmath-5.4.16-46.el7.x86_64
php-gd-5.4.16-46.el7.x86_64
yum remove php*5.4.16* -y
rpm -qa|grep php
2.安裝擴展yum源以及remi資源包
yum install epel-release -y
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
yum repolist|grep remi
remi-safe Safe Remi's RPM repository for Enterprise Linux 7 - x86_64
3.安裝php-httpd等模塊
yum --enablerepo=remi-php73 install \
php-xml php-soap php-xmlrpc php-mbstring \
php-json php-gd php-mcrypt
測試一下應該有php模塊了
httpd -M|grep php
php7_module (shared)
修改配置文件httpd.conf
#<FilesMatch \.php$>
# SetHandler "proxy:fcgi://127.0.0.1:9000"
#</FilesMatch>
將原有php-fpm模式註釋即可!
##注意:需要暫時將虛擬機配置文件改名,否則不能解析php文件
cd /etc/httpd/conf.d && mv vh.conf vh.conf.fpm
systemctl restart httpd