Linux Mint 16 (Saucy): Downgrade PHP 5.5 to 5.4.9 (and Apache too)


After much searching, the solution was found by user marcinello at Super User.

Why would someone want to downgrade PHP 5.5 to 5.4.9? Primarily it’s because PHP 5.5 is the first to deprecate the MySQL extension (suggesting either MySQLi or PDO), and that means trouble for code which hasn’t been updated.

I wouldn’t recommend doing this for anything but a development server, mainly for the security updates in the newer software, but until your code is a little more futureproof, this is a quick fix:

# upgrade system, so you can add to ignore all updates later
sudo apt-get update
sudo apt-get upgrade
# remove your php, apache, etc
sudo apt-get purge apache2 php5 libapache2-mod-php5 # add here your server packages
# change repositories to raring (with backup)
sudo sed -i.bak "s/saucy/raring/g" /etc/apt/sources.list
# update and install server packages
sudo apt-get update
sudo apt-get install apache2 php5 libapache2-mod-php5 phpmyadmin #add here packages you need and make sure you install php5.4 and apache2.2
# change repositories back to saucy
sudo sed -i "s/raring/saucy/g" /etc/apt/sources.list
# ignore all current upgrades (package hold)
sudo apt-mark hold `aptitude -F%p --disable-columns search ~U`