查看当前 PHP 版本

1
php - v

查看当前 PHP 相关的安装包,删除之

 

1
2
3
4
5
yum list installed |  grep  php
 
yum remove php
 
yum remove php-*

  

更换 RPM 源

1
2
3
4
5
6
7
8
9
#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

安装新版本 PHP

1
2
3
4
5
6
7
php 7.0 /7 .1 /7 .2 分别表示为 70w /71w/72w
 
目前(2018-5-4)
 
CentOs 6.x 的 RPM 源中最高只有 7.1
 
CentOs 7.x 的 RPM 源中有 7.2
1
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

再次检查版本

1
php - v