How to install php 5.4.4 (or newer version of 5.4) on ubuntu 12.04 LTS?

Posted June 2, 2014 69.6k views
Using apt-get upgrade I can only get 5.3.10-1ubuntu3.11. The newest version of Moodle, Moodle 2.7 requires php 5.4.4 at least. I am looking to see how this is possible?
1 comment

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
3 answers
To upgrade to a newer version of PHP 5.4 on Ubuntu 12.04, you can use Ondřej Surý's PPA. He is one of the Debian maintainers of the php5 package. See:

To use it, run:

sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php5-oldstable
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install php5
Thanks for quick response.

I had to execute one other command for all of the rest of your commands to work, as the

add-apt-repository ppa:ondrej/php5

command did not work. So I looked this failure up on Stackoverflow and executed following command in addition

apt-get install python-software-properties

After which all went smoothly. My Moodle 2.7 installation on Ubuntu 12.04 using PHP (cli) (built: May 5 2014 09:32:44), (rest of LAMP same as parts of standard package) is now up and running.