Php – Downgrade PHP 5.4 to 5.3 in Debian

debianPHPphp5

I had to do a Debian dist-upgrade on my server… in the process, PHP got upgraded to 5.4. We use ioncube which only supports up to 5.3 atm, and I'm having some trouble finding how to downgrade to 5.3 from 5.4. Anyone know how?

Best Answer

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}'
Related Topic