测试系统为RHEL7.5
1.升级PHP至PHP7
#1.查看已安装的php组件,根据查询到的组件名称卸载已安装的旧版php
[root@localhost ~]# for i in $(yum list installed | grep ^php | awk '{print $1}');do yum remove $i -y;done
#2.配置外部yum源
yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm https://mirror.webtatic.com/yum/el7/webtatic-release.rpm -y
#3.查看新配置的yum源中是否有php7
[root@localhost ~]# yum search php7
#4.安装php7及所需要的扩展
[root@localhost ~]# yum -y install php72w php72w-cli php72w-common php72w-devel php72w-embedded php72w-fpm php72w-gd php72w-mbstring php72w-mysqlnd php72w-opcache php72w-pdo php72w-xml
#5.重启服务
[root@localhost ~]# systemctl restart httpd php-fpm