在 CentOS 5.4 上将 PHP 从 5.1 升级到 5.2

在 CentOS 5.4 上将 PHP 从 5.1 升级到 5.2

我正在尝试在 CentOS 5.4 上将 php 5.1 升级到 5.2

我用:

yum upgrade php

结果是这样的(查看最后一部分):

[root@mail httpd]# yum update php
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * addons: mirror.raystedman.net
 * base: mirrors.serveraxis.net
 * centosplus: mirrors.tummy.com
 * contrib: mirror.raystedman.net
 * extras: mirror.raystedman.net
 * updates: mirrors.netdna.com
Setting up Update Process
Resolving Dependencies
--> Running transaction check
--> Processing Dependency: php = 5.1.6-27.el5 for package: php-devel
--> Processing Dependency: php = 5.1.6 for package: php-eaccelerator
---> Package php.x86_64 0:5.2.10-1.el5.centos set to be updated
--> Processing Dependency: php-cli = 5.2.10-1.el5.centos for package: php
--> Processing Dependency: php-common = 5.2.10-1.el5.centos for package: php
--> Running transaction check
--> Processing Dependency: php = 5.1.6 for package: php-eaccelerator
---> Package php-cli.x86_64 0:5.2.10-1.el5.centos set to be updated
--> Processing Dependency: php-common = 5.1.6-27.el5 for package: php-xml
--> Processing Dependency: php-common = 5.1.6-27.el5 for package: php-pdo
--> Processing Dependency: php-common = 5.1.6-27.el5 for package: php-gd
--> Processing Dependency: php-common = 5.1.6-27.el5 for package: php-ldap
--> Processing Dependency: php-common = 5.1.6-27.el5 for package: php-mbstring
--> Processing Dependency: php-common = 5.1.6-27.el5 for package: php-mysql
--> Processing Dependency: php-common = 5.1.6-27.el5 for package: php-imap
---> Package php-common.x86_64 0:5.2.10-1.el5.centos set to be updated
---> Package php-devel.x86_64 0:5.2.10-1.el5.centos set to be updated
--> Running transaction check
--> Processing Dependency: php = 5.1.6 for package: php-eaccelerator
---> Package php-gd.x86_64 0:5.2.10-1.el5.centos set to be updated
---> Package php-imap.x86_64 0:5.2.10-1.el5.centos set to be updated
---> Package php-ldap.x86_64 0:5.2.10-1.el5.centos set to be updated
---> Package php-mbstring.x86_64 0:5.2.10-1.el5.centos set to be updated
---> Package php-mysql.x86_64 0:5.2.10-1.el5.centos set to be updated
---> Package php-pdo.x86_64 0:5.2.10-1.el5.centos set to be updated
---> Package php-xml.x86_64 0:5.2.10-1.el5.centos set to be updated
--> Finished Dependency Resolution
php-eaccelerator-5.1.6_0.9.5.2-4.el5.rf.x86_64 from installed has depsolving problems
  --> Missing Dependency: php = 5.1.6 is needed by package php-eaccelerator-5.1.6_0.9.5.2-4.el5.rf.x86_64 (installed)
Error: Missing Dependency: php = 5.1.6 is needed by package php-eaccelerator-5.1.6_0.9.5.2-4.el5.rf.x86_64 (installed)
 You could try using --skip-broken to work around the problem
 You could try running: package-cleanup --problems
                        package-cleanup --dupes
                        rpm -Va --nofiles --nodigest
The program package-cleanup is found in the yum-utils package.
[root@mail httpd]# 

使用 --skip-broken 会有什么后果?有什么建议吗?

答案1

您的 php-eaccelerator 版本与您当前的 PHP 版本相关联。通常,它会自动更新,但我猜想这个包要么是手动安装的,没有使用存储库,要么存储库没有与您要安装的较新 PHP 兼容的版本。

如果您 skip-broken 或 --exclude php-eaccelerator,PHP 将升级,但该模块可能无法工作。

如果您随后可以找到新版本的 php-eaccelerator 并单独安装,那就完全没问题了。

答案2

使用 yum remove php 删除默认 PHP。然后,您可以使用以下方式更新到 PHP 5.3.x

yum 更新 php53

该选项在 Centos 5.6 发布时(2011 年 4 月)可用。

我们都对 RHEL/Centos 默认 php (5.1.6) 感到“失望”。另外,使用其他 repos 进行 php/mysql 更新也是个好主意(例如 Remi、Utter Ramblings、EPEL、CentOS ALT 等)...

此致

答案3

--skip-broken 选项将排除导致错误的包。因此,如果在您的情况下,失败的依赖包是 php,那么它将被排除。

当我遇到此问题时,通常我会删除软件包依赖项(无法更新或已安装),然后执行一点 yum clean-all,并更新/安装我想要的。如果一切顺利,我会查看 rpm depos 网站(这些:包裹转骨rpm查找) 并手动安装我删除的软件包。

希望对你有帮助。

相关内容