PHP 5.2 on Ubuntu 11.04 Oneiric

For the time being, we need PHP 5.2 on some of our servers. From version 10.04 Lucid Lynx, Ubuntu started shipping PHP 5.3. I found info on how to install PHP on Lucid by using the packages from the previous version of Ubuntu, 9.10 Karmic Koala.

However, those packages are no longer online, Karmic is long past end of life. The only currently supported release that still has PHP 5.2 is 8.04 Hardy. I was able to get PHP 5.2.4 installed (eventually) using the packages from hardy.

I created two files /etc/apt/sources.list.d/hardy.list and /etc/apt/preferences.d/pin-php52. Then the following met my needs:

sudo apt-get install apache2 apache2-mpm-prefork apache2-utils apache2.2-bin apache2.2-common libapache2-mod-php5 php5-cli php5-common php5-curl php5-gd php5-mcrypt php5-mhash php5-mysql

I constructed the two files mostly from things I read about how to get packages from Karmic to install on Lucid. YMMV.

4 thoughts on “PHP 5.2 on Ubuntu 11.04 Oneiric”

  1. You legend, thanks. Note I had to do an apt-get update before the apt-get install for this to work.

Leave a Reply

Your email address will not be published. Required fields are marked *