ubuntu 12.04 LTS中PHP 5.2.x的安装命令

时间:2013-10-07 07:40:20

标签: ubuntu-12.04

我已经在LTS中安装了很多东西来安装PHP 5.2.9和5.2.10,但它不能正常工作我想要在ubuntu 12.04 LTS中安装PHP 5.2.x的命令。

1 个答案:

答案 0 :(得分:1)

请尝试以下脚本,我将此归功于此博文http://www.nicovs.be/install-php-5-2-on-ubuntu-12-04/

# Script to install PHP 5.2 from 9.10 on 10.04/12.04
# And pin it so it does not get updated

PKGS=`dpkg -l | grep php | awk '{print $2}'`

apt-get remove $PKGS

sed s/precise/karmic/g /etc/apt/sources.list |
  tee /etc/apt/sources.list.d/karmic.list

sed -i 's/archive.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list.d/karmic.list

mkdir -p /etc/apt/preferences.d/

for PACKAGE in $PKGS
do
  echo "Package: $PACKAGE
  Pin: release a=karmic
  Pin-Priority: 991
  " | tee -a /etc/apt/preferences.d/php
done

apt-get update

apt-get install $PKGS