红联Linux门户
Linux帮助

Ubuntu上安裝php 5.2

发布时间:2015-04-29 09:59:02来源:linux网站作者:minierp

Ubuntu上 php 版本是 5.3 不能用  zend Optimizer 只能改用 5.2 了。


第一步:
sed s/lucid/karmic/g /etc/apt/sources.list | sudo tee /etc/apt/sources.list.d/karmic.list


第二步:
在 /etc/apt/preferences.d 中新建一个文件 php 内容如下:
Package: php5
Pin: release a=karmic
Pin-Priority: 991
Package: php5-gd
Pin: release a=karmic
Pin-Priority: 991
Package: php5-common
Pin: release a=karmic
Pin-Priority: 991
Package: php5-curl
Pin: release a=karmic
Pin-Priority: 991
Package: php5-mysql
Pin: release a=karmic
Pin-Priority: 991
Package: php5-pear
Pin: release a=karmic
Pin-Priority: 991
Package: php5-xsl
Pin: release a=karmic
Pin-Priority: 991
Package: php-pear
Pin: release a=karmic
Pin-Priority: 991
Package: php5-cli
Pin: release a=karmic
Pin-Priority: 991
Package: php5-memcache
Pin: release a=karmic
Pin-Priority: 991
Package: php5-pgsql
Pin: release a=karmic
Pin-Priority: 991
Package: libapache2-mod-php5
Pin: release a=karmic
Pin-Priority: 991


第三步:
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


补充: 如果沒有安装 apache2 和 mysql 执行
sudo apt-get install apache2 mysql-server php5 libapache2-mod-php5 php5-xsl php5-gd php-pear libapache2-mod-auth-mysql php5-mysql php5-curl php5-memcache


搞定。