1. 查看CentOS版本
# cat /etc/issue
CentOS release 6.9 (Final)
2. 查看PHP、MySQL版本
# php -v && mysql -V
PHP 5.6.40 (cli) (built: Jan 12 2019 09:19:57)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
mysql Ver 14.14 Distrib 5.1.73, for redhat-linux-gnu (x86_64) using readline 5.1
3. 查看已经安装的PHP、MySQL扩展包并卸载
# yum list installed php* mysql*
Installed Packages
php56w.x86_64 5.6.40-1.w6 @webtatic
php56w-cli.x86_64 5.6.40-1.w6 @webtatic
php56w-common.x86_64 5.6.40-1.w6 @webtatic
php56w-devel.x86_64 5.6.40-1.w6 @webtatic
php56w-fpm.x86_64 5.6.40-1.w6 @webtatic
php56w-gd.x86_64 5.6.40-1.w6 @webtatic
php56w-ldap.x86_64 5.6.40-1.w6 @webtatic
php56w-mbstring.x86_64 5.6.40-1.w6 @webtatic
php56w-mcrypt.x86_64 5.6.40-1.w6 @webtatic
php56w-mysqlnd.x86_64 5.6.40-1.w6 @webtatic
php56w-opcache.x86_64 5.6.40-1.w6 @webtatic
php56w-pdo.x86_64 5.6.40-1.w6 @webtatic
php56w-xml.x86_64 5.6.40-1.w6 @webtatic
mysql.x86_64 5.1.73-8.el6_8 @base
mysql-connector-odbc.x86_64 5.1.5r1144-7.el6 @base
mysql-devel.x86_64 5.1.73-8.el6_8 @base
mysql-libs.x86_64 5.1.73-8.el6_8 @base
mysql-server.x86_64 5.1.73-8.el6_8 @base
卸载上述已经安装的PHP、MySQL包,并重新检查卸载结果
# yum remove php* php-common
# yum remove mysql*
# yum list installed php* mysql*
4. 安装PHP 7.1
4.1 安装yum源
# rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
# rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
4.2 查看PHP 7.1扩展列表
# yum list php71w*
Available Packages
php71w-bcmath.x86_64 7.1.29-1.w6 webtatic
php71w-cli.x86_64 7.1.29-1.w6 webtatic
php71w-common.x86_64 7.1.29-1.w6 webtatic
php71w-dba.x86_64 7.1.29-1.w6 webtatic
php71w-devel.x86_64 7.1.29-1.w6 webtatic
php71w-embedded.x86_64 7.1.29-1.w6 webtatic
php71w-enchant.x86_64 7.1.29-1.w6 webtatic
php71w-fpm.x86_64 7.1.29-1.w6 webtatic
php71w-gd.x86_64 7.1.29-1.w6 webtatic
... ...
4.3 安装PHP及其常用扩展
# yum -y install php71w php71w-fpm php71w-mysql php70w-mbstring php71w-gd php71w-xml