Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Unfortunately I did upgrade PHP to version 5.3, but it end up breaking up some web apps, now I'm trying to go back to 5.2. I removed both sources from /etc/apt/sources.list and I did apt-get update && apt-get upgrade, but it didn't downgrade anything.

Any ideas on how to go back will be appreciated


share|improve this question

Apt won't downgrade packages by default. What you want to do is for each of the packages you want to downgrade, run apt-get install <package>=<version to downgrade to>, so something like apt-get install php5-mysql=5.2.6.dfsg.1-1+lenny3 for example.

share|improve this answer
I remember upgrading lots packages when I did apt-upgrade. How would you know which packages do you need to downgrade besides the core php 5.2? – Ron Dec 18 '09 at 3:58
Probably everything relating to PHP; Most good repos tag their package versions with a unique tag, like 'dotdeb'; I expect that dpkg -l |grep dotdeb will probably list all of the relevant packages; you'll need to apt-cache policy <package> to get the version you want to downgrade to. – womble Dec 18 '09 at 6:47

Check your /var/cache/apt/archives directory. If you haven't done an apt-get clean recently, you will have the original .deb files on your system.

ls -al *5.2.12*deb

if that contains libapache2-mod-php5 and all of the php5 modules that you normally use, you can either dpkg -i the entire list of them, or, if there aren't any extras,

dpkg -i *5.2.12*deb
share|improve this answer

This post tell you how to install php from "karmic" repositary

# remove all php packge
sudo aptitude purge `dpkg -l | grep php| awk '{print $2}' |tr "\n" " "`
# use karmiс for php pakage
# pin-params:  a (archive), c (components), v (version), o (origin) and l (label).
echo -e "Package: php5\nPin: release v=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 v=karmic\nPin-Priority: 991\n"}'|sudo tee  /etc/apt/preferences.d/php > /dev/null
# add karmic to source list
sed s/lucid/karmic/g /etc/apt/sources.list | sudo tee -a /etc/apt/sources.list.d/karmic.list
# update package database (use apt-get if aptitude crash)
sudo apt-get update
# install php
sudo apt-get install -t karmic php5-cli php5-cgi
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.