ubuntu 10.04 php5.3降级安装5.2的方法

Posted by

因为要用到Zend Optimizer,但Zend Optimizer v3.3.9并不支持php5.3,特别是在国内一些程序开发商,一直使用旧的平台,新的zend guard与Zend Optimizer并不兼容,所以近切的需要将php5.3降级为5.2
因为这个问题,我折腾了整整一天,按照网上的教程,使用karmic源(UBUNTU 9.10),一直没有成功。一直安装的都是PHP5.3.3
后终于找到原因:ubuntu 9.10的支持日期已经过了,网络上面的karmic源全是错误的,正常的源karmic.list应该是:

# deb cdrom:[Ubuntu 10.04 LTS _Lucid Lynx_ - Release amd64 (20100429)]/ karmic main restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.

deb http://old-releases.ubuntu.com/ubuntu/ karmic main restricted
deb-src http://old-releases.ubuntu.com/ubuntu/ karmic main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://old-releases.ubuntu.com/ubuntu/ karmic-updates main restricted
deb-src http://old-releases.ubuntu.com/ubuntu/ karmic-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://old-releases.ubuntu.com/ubuntu/ karmic universe
deb-src http://old-releases.ubuntu.com/ubuntu/ karmic universe
deb http://old-releases.ubuntu.com/ubuntu/ karmic-updates universe
deb-src http://old-releases.ubuntu.com/ubuntu/ karmic-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu 
## team, and may not be under a free licence. Please satisfy yourself as to 
## your rights to use the software. Also, please note that software in 
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://old-releases.ubuntu.com/ubuntu/ karmic multiverse
deb-src http://old-releases.ubuntu.com/ubuntu/ karmic multiverse
deb http://old-releases.ubuntu.com/ubuntu/ karmic-updates multiverse
deb-src http://old-releases.ubuntu.com/ubuntu/ karmic-updates multiverse

## Uncomment the following two lines to add software from the 'backports'
## repository.
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
# deb http://old-releases.ubuntu.com/ubuntu/ karmic-backports main restricted universe multiverse
# deb-src http://old-releases.ubuntu.com/ubuntu/ karmic-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu karmic partner
# deb-src http://archive.canonical.com/ubuntu karmic partner

deb http://old-releases.ubuntu.com/ubuntu karmic-security main restricted
deb-src http://old-releases.ubuntu.com/ubuntu karmic-security main restricted
deb http://old-releases.ubuntu.com/ubuntu karmic-security universe
deb-src http://old-releases.ubuntu.com/ubuntu karmic-security universe
deb http://old-releases.ubuntu.com/ubuntu karmic-security multiverse
deb-src http://old-releases.ubuntu.com/ubuntu karmic-security multiverse

操作过程如下:

1、下载附件
ubuntu安装php5.2所需文件 (下载675 )
karmic.list 放在/etc/apt/sources.list.d目录中
php 放在/etc/apt/preferences.d目录中
2、运行命令

sudo apt-get update
sudo apt-get remove php5 libapache2-mod-php5 php5-xsl php5-gd php-pear php5-mysql php5-curl php5-memcache
sudo apt-get install php5 libapache2-mod-php5 php5-xsl php5-gd php-pear php5-mysql php5-curl php5-memcache

我在php文件中还加入了 libapache2-mod-php5,php5-mcrypt,php5-dev,php5-xcache
例如需要安装xcache,直接运行:

sudo apt-get install php5-xcache

如果需要能过APT-GET安装其它的组件,需要更改上面的php文件,在最后面加入组件的名字即可,非常方便

Leave a Reply

您的电子邮箱地址不会被公开。 必填项已用 * 标注