![在 CentOS 5.4 上将 PHP 从 5.1 升级到 5.2](https://linux22.com/image/553235/%E5%9C%A8%20CentOS%205.4%20%E4%B8%8A%E5%B0%86%20PHP%20%E4%BB%8E%205.1%20%E5%8D%87%E7%BA%A7%E5%88%B0%205.2.png)
我正在尝试在 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 等)...
此致