Monday, 19 September 2011

Downgrade PHP 5.3 to 5.2 in centos 6.

The centos 6 normally comes with php 5.3. You can do the following procedures do downgrade the php version to 5.2.

1. Take the copy of the previous installed rpm to any one of the folder.

--------------
[root@cronline ~]# rpm -qa|grep php >>/root/php_modules/php_module.txt
[root@cronline ~]# cat /root/php_modules/php_module.txt
php-mysql-5.3.2-6.el6_0.1.x86_64
php-pear-1.9.0-2.el6.noarch
php-cli-5.3.2-6.el6_0.1.x86_64
php-pdo-5.3.2-6.el6_0.1.x86_64
php-pecl-memcache-3.0.4-3.2.el6.2.x86_64
php-5.3.2-6.el6_0.1.x86_64
php-devel-5.3.2-6.el6_0.1.x86_64
php-imap-5.3.2-6.el6_0.1.x86_64
php-common-5.3.2-6.el6_0.1.x86_64
[root@cronline ~]#
--------------

2. Remove the existing PHP 5.3 RPM in the server.

-------------------
[root@cronline ~]# rpm -e --nodeps php-pecl-memcache-3.0.4-3.2.el6.2.x86_64 php-5.3.2-6.el6_0.1.x86_64 php-devel-5.3.2-6.el6_0.1.x86_64 php-imap-5.3.2-6.el6_0.1.x86_64 php-common-5.3.2-6.el6_0.1.x86_64
-------------------

3. Download the corresponding PHP 5.2 version from the "http://www6.atomicorp.com/" webiste.

-----------------
[root@cronline ~]# wget http://www6.atomicorp.com/channels/atomic/centos/6/x86_64/RPMS/php-mysql-5.2.17-1.el6.art.x86_64.rpm
[root@cronline ~]# wget http://www6.atomicorp.com/channels/atomic/centos/6/x86_64/RPMS/php-cli-5.2.17-1.el6.art.x86_64.rpm
[root@cronline ~]# wget http://www6.atomicorp.com/channels/atomic/centos/6/x86_64/RPMS/php-pdo-5.2.17-1.el6.art.x86_64.rpm
[root@cronline ~]# wget http://www6.atomicorp.com/channels/atomic/centos/6/x86_64/RPMS/php-5.2.17-1.el6.art.x86_64.rpm
[root@cronline ~]# wget http://www6.atomicorp.com/channels/atomic/centos/6/x86_64/RPMS/php-devel-5.2.17-1.el6.art.x86_64.rpm
[root@cronline ~]# wget http://www6.atomicorp.com/channels/atomic/centos/6/x86_64/RPMS/php-imap-5.2.17-1.el6.art.x86_64.rpm
[root@cronline ~]# wget http://www6.atomicorp.com/channels/atomic/centos/6/x86_64/RPMS/php-common-5.2.17-1.el6.art.x86_64.rpm
-----------------

4. Install the downloaded PHP 5.2 RPM .

-----------------
[root@cronline ~]# rpm -ivh --nodeps php-devel-5.2.17-1.el6.art.x86_64.rpm php-pdo-5.2.17-1.el6.art.x86_64.rpm php-cli-5.2.17-1.el6.art.x86_64.rpm php-mysql-5.2.17-1.el6.art.x86_64.rpm php-imap-5.2.17-1.el6.art.x86_64.rpm php-common-5.2.17-1.el6.art.x86_64.rpm
-----------------

5. Finally restart the webserver.

-------------
[root@cronline ~]#/etc/init.d/httpd restart
Stopping httpd: [ OK ]
Startinging httpd: [ OK ]
-------------

6. The next important think is to exclude the php in yum.conf. If you are not excluding this line PHP will be upgraded if we enter yum update command in the server.

---------------
[root@cronline ~]# cat /etc/yum.conf|grep php
exclude=php*
[root@cronline ~]#
---------------

1 comment:

Anonymous said...

Hmmm, the commands worked as show. However now apache does no longer execute the php, but displays it as text...

More googling...