Ubuntu 10.04 上安裝 php 5.2
ubuntu 10.04 上 php 版本是 5.3有很多软件不支持,例如 不能用ZendDebugger,linux版本的ZendDebugger目前只支持5.2的, 只能改用 5.2 了 ,本文介绍如何删除php5.3,再安装php5.2的方法。第一步:查看已经安装的php5相关的软件; dpkg -l | grep php
或者 dpkg -l | grep php >delete 把文件列表写到一个文件中,以方便删除。
ii libapache2-mod-php5 5.3.2-1ubuntu4.2 server-side, HTML-embedded scripting languag
ii php5 5.3.2-1ubuntu4.2 server-side, HTML-embedded scripting languag
ii php5-cli 5.3.2-1ubuntu4.2 command-line interpreter for the php5 script
ii php5-common 5.3.2-1ubuntu4.2 Common files for packages built from the php
ii php5-mysql 5.3.2-1ubuntu4.2 MySQL module for php5
如果你的版本不是5。3就不用往下看了。
第二步: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-mysql php5-cli
sudo apt-get install php5 libapache2-mod-php5 php5-gd php5-mysql php5-cli
完工,重启apache,用phpinfo 显示PHP Version 5.2.10-2ubuntu6,说明我的php为5.2.10。
欢迎转载,请注明出处:亲亲宝宝