1.查看当前 PHP 版本
php -v
查看当前 PHP 相关的安装包,删除之
yum list installed | grep php
yum remove php
yum remove php-*
2.更换 RPM 源
#Centos 5.X:rpm -Uvh http://mirror.webtatic.com/yum/el5/latest.rpm
#CentOs 6.x:rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
#CentOs 7.X:rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
3.安装新版本 PHP
php 7.0/7.1/7.2 分别表示为 70w/71w/72w目前(2018-5-4)CentOs 6.x 的 RPM 源中最高只有 7.1CentOs 7.x 的 RPM 源中有 7.2
yum install -y php71w php71w-cli php71w-common php71w-devel php71w-embedded php71w-fpm php71w-gd php71w-mbstring php71w-mysqlnd php71w-opcache php71w-pdo php71w-xml php71w-ldap php71w-mcrypt
4.再次检查版本
php -v