2012年4月12日 星期四

[PHP] 在 centos6 將 PHP 5.3 降版至 5.2



1. 安裝 atomic  repository
wget -q -O - http://www.atomicorp.com/installers/atomic | sh
安裝完畢會看到 /etc/yum.repos.d/atomic.repo

2. 移除 php5.3 (如無安裝過即跳過此步驟)
yum remove php*

3. 安裝 php 5.2
php-5.2* php-mbstring-5.2* php-xml-5.2* php-ldap-5.2* php-gd-5.2* php-xml-5.2* php-pdo-5.2*

4.避免升級到 php 5.3
vi /etc/yum.repos.d/atomic.repo  或 /etc/yum.conf
加入  exclude=php-5.3*  (加在 [atomic] 內)


Ref: https://www6.atomicorp.com/channels/atomic/centos/6/x86_64/RPMS/










下面是舊方法~

rpm -qa | grep php
rpm -e --nodeps phpxxxx

32bit

wget http://www6.atomicorp.com/channels/atomic/centos/6/i386/RPMS/php-5.2.17-1.el6.art.i686.rpm
wget http://www6.atomicorp.com/channels/atomic/centos/6/i386/RPMS/php-cli-5.2.17-1.el6.art.i686.rpm
wget http://www6.atomicorp.com/channels/atomic/centos/6/i386/RPMS/php-common-5.2.17-1.el6.art.i686.rpm
wget http://www6.atomicorp.com/channels/atomic/centos/6/i386/RPMS/php-mbstring-5.2.17-1.el6.art.i686.rpm
wget http://www6.atomicorp.com/channels/atomic/centos/6/i386/RPMS/php-devel-5.2.17-1.el6.art.i686.rpm
wget http://www6.atomicorp.com/channels/atomic/centos/6/i386/RPMS/php-ldap-5.2.17-1.el6.art.i686.rpm
wget http://www6.atomicorp.com/channels/atomic/centos/6/i386/RPMS/php-gd-5.2.17-1.el6.art.i686.rpm
wget http://www6.atomicorp.com/channels/atomic/centos/6/i386/RPMS/php-xml-5.2.17-1.el6.art.i686.rpm
wget http://www6.atomicorp.com/channels/atomic/centos/6/i386/RPMS/php-pdo-5.2.17-1.el6.art.i686.rpm

rpm -ivh php-common-5.2.17-1.el6.art.i686.rpm
rpm -ivh php-cli-5.2.17-1.el6.art.i686.rpm
rpm -ivh php-5.2.17-1.el6.art.i686.rpm
rpm -ivh php-mbstring-5.2.17-1.el6.art.i686.rpm
rpm -ivh php-xml-5.2.17-1.el6.art.i686.rpm
rpm -ivh php-ldap-5.2.17-1.el6.art.i686.rpm
rpm -ivh php-gd-5.2.17-1.el6.art.i686.rpm
rpm -ivh php-devel-5.2.17-1.el6.art.i686.rpm
rpm -ivh php-pdo-5.2.17-1.el6.art.i686.rpm

yum install libXpm.so.4 libt1.so.5 autoconf automake

64bit

wget http://www6.atomicorp.com/channels/atomic/centos/6/x86_64/RPMS/php-5.2.17-1.el6.art.x86_64.rpm
wget http://www6.atomicorp.com/channels/atomic/centos/6/x86_64/RPMS/php-cli-5.2.17-1.el6.art.x86_64.rpm
wget http://www6.atomicorp.com/channels/atomic/centos/6/x86_64/RPMS/php-common-5.2.17-1.el6.art.x86_64.rpm
wget http://www6.atomicorp.com/channels/atomic/centos/6/x86_64/RPMS/php-mbstring-5.2.17-1.el6.art.x86_64.rpm
wget http://www6.atomicorp.com/channels/atomic/centos/6/x86_64/RPMS/php-devel-5.2.17-1.el6.art.x86_64.rpm
wget http://www6.atomicorp.com/channels/atomic/centos/6/x86_64/RPMS/php-ldap-5.2.17-1.el6.art.x86_64.rpm
wget http://www6.atomicorp.com/channels/atomic/centos/6/x86_64/RPMS/php-gd-5.2.17-1.el6.art.x86_64.rpm
wget http://www6.atomicorp.com/channels/atomic/centos/6/x86_64/RPMS/php-xml-5.2.17-1.el6.art.x86_64.rpm
wget http://www6.atomicorp.com/channels/atomic/centos/6/x86_64/RPMS/php-pdo-5.2.17-1.el6.art.x86_64.rpm

rpm -ivh php-common-5.2.17-1.el6.art.x86_64.rpm
rpm -ivh php-cli-5.2.17-1.el6.art.x86_64.rpm
rpm -ivh php-5.2.17-1.el6.art.x86_64.rpm
rpm -ivh php-mbstring-5.2.17-1.el6.art.x86_64.rpm
rpm -ivh php-xml-5.2.17-1.el6.art.x86_64.rpm
rpm -ivh php-ldap-5.2.17-1.el6.art.x86_64.rpm
wget http://mirror.centos.org/centos/6/os/x86_64/Packages/libXpm-3.5.8-2.el6.x86_64.rpm
rpm -ivh libXpm-3.5.8-2.el6.x86_64.rpm
wget http://mirror.centos.org/centos/6/os/x86_64/Packages/t1lib-5.1.2-6.el6.x86_64.rpm
rpm -ivh t1lib-5.1.2-6.el6.x86_64.rp
rpm -ivh php-gd-5.2.17-1.el6.art.x86_64.rpm
rpm -ivh php-xml-5.2.17-1.el6.art.x86_64.rpm
rpm -ivh php-pdo-5.2.17-1.el6.art.x86_64.rpm


vi /etc/php.ini
把 short_open_tag = Off 改成 On
service httpd restart

避免 yum 更新到 php 做以下設定
vi /etc/yum.conf
加入
exclude=php*

Ref :
http://linux-bloggers.blogspot.com/2011/09/downgrade-php-in-centos-6.html

沒有留言:

張貼留言