背景:当前php版本为7.0.31,升级为php7.1.*
参考链接:https://www.cnblogs.com/lightsrs/p/7899676.html
1、由于linux的yum源不存在php7.x,所以我们要更改yum源:
#rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm #rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
2、yum查询安装php71w
#yum search php71w
3、yum 安装php71w和各种拓展,选自己需要的即可。
#yum install php71w php71w-cli php71w-common php71w-devel php71w-embedded php71w-fpm php71w-gd php71w-mbstring php71w-mysqlnd php71w-opcache php71w-pdo php71w-xml
在安装 yum install yum71w-cli 时报错
Error: php71w-common conflicts with php70w-common-7.0.31-1.w7.x86_64
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
修复:yum -y remove php70w-common-7.0.31-1.w7.x86_64
修复完成后重新执行 yum install yum71w-cli
4. 执行php -v
执行结果显示当前为 PHP 7.1.20 (cli)