如何解决 php 版本不匹配的问题(Centos 6)

How to solve php versions mis-match (Centos 6)

我是 运行 Centos 6 服务器。在尝试安装 php 7.2 后,我遇到了一些依赖性问题(尝试 yum update php): 那么重新安装 php 的最佳和最安全的方法是什么?

--> Running transaction check
---> Package libwebp.x86_64 0:0.4.3-3.el6 will be installed
---> Package php56w-common.x86_64 0:5.6.40-1.w6 will be obsoleted
--> Processing Dependency: php56w-common(x86-64) = 5.6.40-1.w6 for package: php56w-phpdbg-5.6.40- 
1.w6.x86_64
--> Finished Dependency Resolution
Error: Package: php56w-phpdbg-5.6.40-1.w6.x86_64 (@webtatic)
       Requires: php56w-common(x86-64) = 5.6.40-1.w6
       Removing: php56w-common-5.6.40-1.w6.x86_64 (@webtatic)
           php56w-common(x86-64) = 5.6.40-1.w6
       Obsoleted By: php-common-7.2.34-1.el6.remi.x86_64 (remi-php72)
           Not found
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest

我建议您安装 remi 存储库以安装 php 7.2。您还可以在 php.

的版本之间切换

用于安装

 wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
 wget http://rpms.remirepo.net/enterprise/remi-release-6.rpm
 rpm -Uvh remi-release-6.rpm epel-release-latest-6.noarch.rpm

启用php7.2

yum install yum-utils
yum-config-manager --enable remi-php72

查看here also here了解更多详情

虽然从第 3 方存储库升级到 remi 应该可以顺利进行(这是尽力而为),但您遇到了一个(旧)问题,php-dbg应该废弃 php56w-phpdbg。这已经修复,将在下次更新中。

现在,只需在升级前删除此调试器即可。

yum remove php56w-phpdbg
yum update
yum install php-dbg

像往常一样,请参阅 Wizard instructions

P.S。 webtatic 似乎是一个死项目,大约 1 年没有更新,所以每个人都应该迁移到更好的替代方案,例如“remi”存储库。