Ubuntu – Downgrade PHP from 5.5.3 to 5.4.x in Ubuntu 13.10

downgradePHPUbuntu

During the update from Ubuntu 13.04 to 13.10, PHP was upgraded to 5.5.3.

How can I downgrade to 5.4.x?

Best Answer

  1. As medigeek suggested: you could try to use ondrej php5-oldstable packages, but I think at the moment they don't work on Saucy Salamander.
  2. You can compile PHP on your own.
  3. Easy solution would be to temporarly switch to old (raring) repositories, install PHP (5.4), Apache (2.2), etc and lock package versions (so it won't be upgraded anymore):

Please consider it as a risky operation, as you might loose your settings and break your system. I did not test all the lines, so please tell me if I have to adjust something

# 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`
Related Question