1

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

4

1 回答 1

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
于 2013-12-11T06:09:35.210 回答