Downgrade PHP to 5.2.x on Ubuntu 10.04 - andyceo/documentation GitHub Wiki
===== Как установить PHP 5.2.x на Ubuntu 10.04 =====
:!: **Тестировалось только под Ubuntu 10.04!
==== Скрипт №1 ====
Источник: http://mrkandy.wordpress.com/2010/04/16/install-php-5-2-x-in-ubuntu-10-04-lucid
#!/bin/bash # remove all php packge sudo aptitude purge `dpkg -l | grep php| awk '{print $2}' |tr "\n" " "`echo -e "Package: php5\nPin: release a=karmic\nPin-Priority: 991\n" | sudo tee /etc/apt/preferences.d/php > /dev/null apt-cache search php5-|grep php5-|awk '{print "Package:", $1,"\nPin: release a=karmic\nPin-Priority: 991\n"}'|sudo tee -a /etc/apt/preferences.d/php > /dev/null apt-cache search -n libapache2-mod-php5 |awk '{print "Package:", $1,"\nPin: release a=karmic\nPin-Priority: 991\n"}'| sudo tee -a /etc/apt/preferences.d/php > /dev/null echo -e "Package: php-pear\nPin: release a=karmic\nPin-Priority: 991\n" | sudo tee -a /etc/apt/preferences.d/php > /dev/null
#grep 'main restricted' /etc/apt/sources.list|grep -v "#"| sed s/lucid/karmic/g | sudo tee /etc/apt/sources.list.d/karmic.list > /dev/null egrep '(main restricted|universe|multiverse)' /etc/apt/sources.list|grep -v "#"| sed s/lucid/karmic/g | sudo tee /etc/apt/sources.list.d/karmic.list > /dev/null
sudo aptitude update
sudo aptitude install -t karmic php5 libapache2-mod-php5 php5-common php5-cli php5-mysql php-apc php-pear php5-mcrypt php5-xsl php5-xmlrpc php5-gd php5-imagick php5-curl php5-json
#it is possible to install following packages too: #php5-cgi php5-pgsql php5-sqlite php5-xdebug
#hold the packages versions
sudo aptitude hold dpkg -l | grep php5| awk '{print $2}' |tr "\n" " "
#print the current status of php5 packages dpkg -l | grep php
#done
==== Скрипт №2 ==== Источник: http://community.livejournal.com/ru_ubuntu/433187.html
#!/bin/bash # by Ruben Barkow (rubo77) http://www.entikey.z11.de/Originally Posted by Bachstelze http://ubuntuforums.org/showthread.php?p=9080474#post9080474
echo "Am I root? " if [ "$(whoami &2>/dev/null)" != "root" ] && [ "$(id -un &2>/dev/null)" != "root" ] ; then echo " NO!
Error: You must be root to run this script. Enter sudo su " exit 1 fi echo " OK";
apt-get -f install
PHPLIST=$(for i in $(dpkg -l | grep php|awk '{ print $2 }' ); do echo $i; done) echo these pachets will be removed: $PHPLIST
aptitude remove $PHPLIST
#Create a file each in /etc/apt/preferences.d like this (call it for example /etc/apt/preferences.d/php5.2);
#Package: php5 #Pin: release a=karmic #Pin-Priority: 991
#The big problem is that wildcards don't work, so you will need one such stanza for each PHP package you want to pull from karmic:
echo ''>/etc/apt/preferences.d/php5.2 for i in $PHPLIST ; do echo "Package: $i Pin: release a=karmic Pin-Priority: 991 ">>/etc/apt/preferences.d/php5.2; done
#sed s/lucid/karmic/g /etc/apt/sources.list | sudo tee /etc/apt/sources.list.d/karmic.list
echo "# needed sources vor php5.2: deb http://de.archive.ubuntu.com/ubuntu/ karmic main restricted deb-src http://de.archive.ubuntu.com/ubuntu/ karmic main restricted
deb http://de.archive.ubuntu.com/ubuntu/ karmic-updates main restricted deb-src http://de.archive.ubuntu.com/ubuntu/ karmic-updates main restricted
deb http://de.archive.ubuntu.com/ubuntu/ karmic universe deb-src http://de.archive.ubuntu.com/ubuntu/ karmic universe deb http://de.archive.ubuntu.com/ubuntu/ karmic-updates universe deb-src http://de.archive.ubuntu.com/ubuntu/ karmic-updates universe
deb http://de.archive.ubuntu.com/ubuntu/ karmic multiverse deb-src http://de.archive.ubuntu.com/ubuntu/ karmic multiverse deb http://de.archive.ubuntu.com/ubuntu/ karmic-updates multiverse deb-src http://de.archive.ubuntu.com/ubuntu/ karmic-updates multiverse
deb http://security.ubuntu.com/ubuntu karmic-security main restricted deb-src http://security.ubuntu.com/ubuntu karmic-security main restricted deb http://security.ubuntu.com/ubuntu karmic-security universe deb-src http://security.ubuntu.com/ubuntu karmic-security universe deb http://security.ubuntu.com/ubuntu karmic-security multiverse deb-src http://security.ubuntu.com/ubuntu karmic-security multiverse " >> /etc/apt/sources.list.d/karmic.list
aptitude update
apache2ctl restart
echo install new from karmic: aptitude -t karmic install $PHPLIST
aptitude -t karmic install libapache2-mod-php5
apache2ctl restart