Installing PHP 5.4 on Ubuntu 12.04 (Precise Pangolin)

Installing PHP on Ubuntu 12.04 is very straight forward – however (at the time of writing) the latest version available for Ubuntu 12.04 LTS is 5.3.10, so what if you want to install PHP 5.4.x on your server? Well…

If you’ve never used add-apt-repository you may need to execute the following command

apt-get install python-software-properties

Install a signing key for the PPA (and add a new repo)

add-apt-repository ppa:ondrej/php5

Update the entire apt base

apt-get update -y && apt-get upgrade -y && apt-get dist-upgrade -y

Ta-daaaaa!

 

Source: http://www.barryodonovan.com/index.php/2012/05/22/ubuntu-12-04-precise-pangolin-and-php-5-4-again