Downgrade PHP 5.4 to 5.3 in Debian

Neither of the solutions above worked for me. What did work was pinning the necessary packages to the old stable such as

Add the following to /etc/apt/sources.lst

deb http://ftp.us.debian.org/debian/ squeeze main contrib non-free
deb-src http://ftp.us.debian.org/debian/ squeeze main contrib non-free

Create

/etc/apt/preferences.d/preferences

And add the packages you need downgraded such as in my case

Package: php5*
Pin: release a=oldstable
Pin-Priority: 700

Package: libapache2-mod-php5    
Pin: release a=oldstable
Pin-Priority: 700

Package: libapache2-mod-php5
Pin: release a=oldstable
Pin-Priority: 700

Package: php-pear
Pin: release a=oldstable
Pin-Priority: 700

Package: *
Pin: release a=stable
Pin-Priority: 600

Then run the commands

aptitude update
aptitude reinstall <necessary packages>
/etc/init.d/apache2 restart

If you want to know which packages you need to upgrade just run :

dpkg -l|grep php|grep 5.4|awk '{print $2}'

You could try this, but do it at your own risk. I didn't try it myself. ;)

  • apt-get remove php5
  • Download the PHP5 package from Stable
  • dpkg --force php5_5.3.3-7+squeeze8_all.deb
  • dpkg --set-selections PHP5 hold

The last line to prevent upgrading to 5.4. When you're ready for 5.4, run dpkg --set-selections PHP5 install

IonCube for 5.4 is a little while out from what I've read.