升级PHP7 CentOS7系统下的简易教程
2019-04-19
OS:CentOs 7
1.查看当前 PHP 版本
[root@disconf zbox]# php -v
PHP 5.4.16 (cli) (built: Apr 12 2018 19:02:01)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
2.查看当前 PHP 相关的安装包,删除之
yum list installed | grep php
yum remove php
yum remove php-*
3.更换 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
4.安装新的版本
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
5.再次检查版本
[root@disconf zbox]# php -v
PHP 7.1.27 (cli) (built: Mar 10 2019 16:23:55) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.1.27, Copyright (c) 1999-2018, by Zend Technologies
-- The End --