CentOS – 试图降级php

我需要将PHP 5.3降级到5.2,并且在运行Apache 2.2.3和MySQL 5.1.54的CentOS 5.5 x86_64机器上运行。 我一直有一些问题,现在只是失去了…不知道究竟要包括什么步骤/什么,所以我只是试图分解我所做的事情,让我到了我的突破点。 。

以下是我迄今采取的步骤:

(1)我试着卸载PHP 5.3:

rpm -e --nodeps php-devel php php-cli php-common php-mcrypt php-mysql php-pdo php-ldap php-mbstring php-xml php-xmlrpc php-odbc php-imap php-snmp php-gd //Yielded: warning: /etc/php.ini saved as /etc/php.ini.rpmsave 

(2)然后,我试着安装php:

 yum install php-devel php php-cli php-common php-mcrypt php-mysql php-pdo php-ldap php-mbstring php-xml php-xmlrpc php-odbc php-imap php-snmp php-gd 

但是,愚蠢的是,我意识到(后来)我没有指定回购或PHP版本。 幸运的是(?),没有安装任何东西,因为它产生了这样的结果:

 Transaction Check Error: package libmcrypt-2.5.8-4.el5.centos.x86_64 (which is newer than libmcrypt-2.5.7-5.el5.i386) is already installed 

(3)虽然,我一开始并没有注意到,所以我重新启动apache,然后运行:yum upgrade

一切都很顺利

(4)编辑/etc/my.cnf把skip-bdb放到那里,然后启动mysqld

(5)Ran: mysql_upgrade -uadmin -p cat / etc / psa / .psa.shadow`

(6)尝试谷歌解决scheme后,我遇到了一篇文章,说我需要yum-allowdowngrade,所以,我跑这个: yum install yum-allowdowngrade

(7)为了确保我没有安装PHP,我跑了:yum remove php

这产生了:

 Loaded plugins: allowdowngrade, fastestmirror Setting up Remove Process No Match for argument: php Loading mirror speeds from cached hostfile * atomic: www6.atomicorp.com * base: mirror.rackspace.com * epel: mirror.cogentco.com * extras: mirror.ash.fastserv.com * updates: mirror.ash.fastserv.com atomic | 1.9 kB 00:00 base | 2.1 kB 00:00 epel | 3.7 kB 00:00 extras | 2.1 kB 00:00 rusia-repo | 951 B 00:00 updates | 1.9 kB 00:00 Package(s) php available, but not installed. No Packages marked for removal 

(8)然后,我跑了:

 yum --allow-downgrade --enablerepo=rusia-repo install php-devel-5.2.17-1.el5.x86_64 php-5.2.17-1.el5.x86_64 php-cli-5.2.17-1.el5.x86_64 php-common-5.2.17-1.el5.x86_64 php-mcrypt-5.2.17-1.el5.x86_64 php-mysql-5.2.17-1.el5.x86_64 php-pdo-5.2.17-1.el5.x86_64 php-ldap-5.2.17-1.el5.x86_64 php-mbstring-5.2.17-1.el5.x86_64 php-xml-5.2.17-1.el5.x86_64 php-xmlrpc-5.2.17-1.el5.x86_64 php-odbc-5.2.17-1.el5.x86_64 php-imap-5.2.17-1.el5.x86_64 php-snmp-5.2.17-1.el5.x86_64 php-gd-5.2.17-1.el5.x86_64 

这产生了:

 Loaded plugins: allowdowngrade, fastestmirror Loading mirror speeds from cached hostfile * atomic: www6.atomicorp.com * base: mirror.rackspace.com * epel: mirror.cogentco.com * extras: mirror.ash.fastserv.com * updates: mirror.ash.fastserv.com atomic | 1.9 kB 00:00 base | 2.1 kB 00:00 epel | 3.7 kB 00:00 extras | 2.1 kB 00:00 rusia-repo | 951 B 00:00 updates | 1.9 kB 00:00 Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package php.x86_64 0:5.2.17-1.el5 set to be updated --> Processing Dependency: php-common = 5.2.17-1.el5 for package: php --> Processing Dependency: php-cli = 5.2.17-1.el5 for package: php --> Finished Dependency Resolution php-5.2.17-1.el5.x86_64 from rusia-repo has depsolving problems --> Missing Dependency: php-common = 5.2.17-1.el5 is needed by package php-5.2.17-1.el5.x86_64 (rusia-repo) php-5.2.17-1.el5.x86_64 from rusia-repo has depsolving problems --> Missing Dependency: php-cli = 5.2.17-1.el5 is needed by package php-5.2.17-1.el5.x86_64 (rusia-repo) Error: Missing Dependency: php-common = 5.2.17-1.el5 is needed by package php-5.2.17-1.el5.x86_64 (rusia-repo) Error: Missing Dependency: php-cli = 5.2.17-1.el5 is needed by package php-5.2.17-1.el5.x86_64 (rusia-repo) 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 

我不断得到一系列的这些错误,所以决定只是运行百胜升级,更新回到PHP 5.3,看看我能否得到这个工作,直到我想出了如何正确降级…

所以,我跑了百胜升级,得到:

 yum update Loaded plugins: allowdowngrade, fastestmirror Loading mirror speeds from cached hostfile * atomic: www6.atomicorp.com * base: mirror.rackspace.com * epel: mirror.symnds.com * extras: mirror.symnds.com * updates: mirror.symnds.com Setting up Update Process No Packages marked for Update 

然后,我跑了:

 yum install php-devel php php-cli php-common php-mcrypt php-mysql php-pdo php-ldap php-mbstring php-xml php-xmlrpc php-odbc php-imap php-snmp php-gd 

但是,这产生了:

 Transaction Check Error: package libmcrypt-2.5.8-4.el5.centos.x86_64 (which is newer than libmcrypt-2.5.7-5.el5.i386) is already installed file /usr/bin/phar.phar from install of php-cli-5.3.6-3.el5.art.i386 conflicts with file from package php-cli-5.3.6-3.el5.art.x86_64 file /usr/bin/phpize from install of php-cli-5.3.6-3.el5.art.i386 conflicts with file from package php-cli-5.3.6-3.el5.art.x86_64 

我尝试服务httpd重新启动,并得到:

 Stopping httpd: [FAILED] Starting httpd: httpd: Syntax error on line 210 of /etc/httpd/conf/httpd.conf: Syntax error on line 6 of /etc/httpd/conf.d/php.conf: Cannot load /etc/httpd/modules/libphp5.so into server: /etc/httpd/modules/libphp5.so: cannot open shared object file: No such file or directory 

所以,现在,我完全困惑,真的,真的需要一些帮助…

每当这样的事情发生在我身上(需要一个较旧的副本,然后是什么在回购,或更新)我发现它更容易build立自己的RPM的来源,我build议这样做。

它不是太困难,只需要多一点时间,而且你可以确保你的系统上使用了最新的ELSE,而只是PHP的旧版本(或更新版本)。

http://www.imminentweb.com/technologies/create-centos-php-rpm

应该帮助你在CentOS上构build你自己的PHP RPM的基础知识。

如果你继续走下去的道路,你可能会碰到我称之为“依赖地狱”的东西。旧的PHP需要老版本的X,这是新版本Y所需要的,如果你想要老版本的X,你也需要降级Y,等等等等。 随后的10-15个依赖关系,你运行一个合理的不安全的环境,因为你的系统的一个重要的块运行旧的代码。

“缺less依赖”错误通常是由混合存储库引起的。 我build议你禁用atomicepel回购,并尝试使用CentOStesting回购基于本指南或Jason Litka回购。

你可能想尝试:百胜降级PHP

在你这样做之前禁用任何附加的回购。 您将面临的一个主要问题是,一些附加的回购可能会安装PHP 5.3所需的依赖项,但PHP 5.2不需要(例如不同的sqlite版本)。

在这种情况下,您可能不得不强制删除模块:

rpm -e –nodeps pkgname

然后尝试降级。

如果一切都失败了,用rpm -e –nodeps删除所有php 5.3软件包,然后使用centOS源代码重新安装。