Ubuntu – Installing PHP 5.3 in Ubuntu 14.04

14.04aptPHP

I've just installed Ubuntu 14.04 and am trying to install php 5.3. But when I run

apt-get install php5 

it's installing php 5.5.9-1ubuntu4. I need to use php 5.3 in the system because the application I'm working on is built with php 5.3.

How can I achieve this?

Best Answer

Pre-requisites

You will need these two extra packages if you don't have them:

sudo apt-get install build-essential libxml2-dev

Install PHP

In terminal:

wget http://in1.php.net/distributions/php-5.3.29.tar.bz2
tar -xvf php-5.3.29.tar.bz2
cd php-5.3.29
./configure
make
make test # Neither mandatory nor a bad idea.
sudo make install

The instructions will untar the source build and they will install php in your system.