How to downgrade PHP from 5.3.x to 5.2.x

I need to downgrade my PHP to 5.2.x from 5.3.x Certain software I currently use requires it. I found all these link explaining how to do it but they no longer work because they show you how to use the Karmic archives to downgrade but as those archives no longer exist on archive.ubuntu.com

  • Downgrade PHP to PHP5.2?
  • https://askubuntu.com/questions/47103/how-to-downgrade-from-php-5-3-to-php-5-2-in-ubuntu-10-10-maverick

I found this script on the ubuntu forums which worked for me

http://ubuntuforums.org/showthread.php?t=1566808

On ubuntu 10.10 you'll need to install aptitude as it is no longer installed by default.

sudo apt-get install aptitude

try one of these links: first second


Even when there is no Karmic repos available, you could use older ones from 8.04. For Hardy is 5.2.4 available. So first solution is to use those links and make Karmic -> Hardy.

But mixing repos from two different realeases may become painful. So i don't suggest to add other realease to your apt sources. I prefer to install downloaded deb with dpkg -i php_whatever.deb and set it on hold. Last time i used hold, apt-get did not care about setting hold, so maybe you need to install aptitude and use it for further upgrades.


5.2 is unsupported and RIFE with security holes.

However if you must use it, you can probably port the hardy-security package forward, as it is 5.2.4. It will be supported until April of 2013.

Still, you're going to be in better shape running the distro version of PHP and fixing your PHP apps than trying to deal with old broken PHP.