Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Im setting up a vps for the first time from scratch, the host has a one click LAMP installer which took out allot of the leg work, but running phpinfo(); i found im running 5.3.10.

So id like to update it to 5.4.10 - Ive run sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt but it says php5 is the latest version, any ideas about how to update this ?

The server is running Ubuntu 12.04

share|improve this question
Although I provided an answer, why do you specifically want 5.4.10? 5.3.x in 12.04 tend to get security updates still so any CVEs or security issues between 5.3.x and 5.4.10 are usually fixed... – Thomas Ward Sep 9 '13 at 23:40
up vote 33 down vote accepted

PHP 5.4.10 is not available in the Ubuntu repositories for 12.04.

You have two options:

(1) try and find a PPA with a backported version of PHP 5.4.10 (such as ondrej's oldstable PPA)

a) Run this command: sudo apt-get install python-software-properties
b) Run this command: sudo add-apt-repository ppa:ondrej/php5-oldstable
c) Run sudo apt-get update; sudo apt-get install php5
d) This should allow you to use PHP 5.4.10 (or whatever the most recent "Old Stable PHP" is).

(2) download PHP from source, and compile it.

5.4.10 does not exist in the repositories for any version of Ubuntu, apparently, so you're stuck with these two options for all releases.

(I can try and backport 5.4.10 from Debian if you would like, but it would be in a PPA, so you'd have to trust that I'm not giving you malware, although I wouldn't do that ever.)

share|improve this answer
Thanks @Thomas W - looking back at the downloads it seems the last stable version of 5.4 was 5.4.19 is that easier to install seeing as its the current Old stable ? – sam Sep 10 '13 at 9:47
@sam No, that's no easier to install than 5.4.10, as it is not in the repositories and would need to be put into a PPA or compiled from source to be installed. – Thomas Ward Sep 10 '13 at 14:37
Thanks @Thomas W - i actually ended up getting to work using sudo add-apt-repository ppa:ondrej/php5-oldstable which installed 5.4.19 - taken from HERE – sam Sep 10 '13 at 19:23
@sam Yeah, ondrej's PPA is decent, I'll also add that data here. – Thomas Ward Sep 11 '13 at 1:51
Thanks - i think an important point to add is that you also need to have run apt-get install python-software-properties to be able to use add-apt-repository – sam Sep 11 '13 at 8:37

Installing PHP 5.4.* on Ubuntu 12.04 Simply add the PPA repository:

sudo add-apt-repository ppa:ondrej/php5-oldstable

And install it:

sudo apt-get update
sudo apt-get install php5
share|improve this answer

You don't need to add repositories. Simply use these steps:

  1. sudo add-apt-repository ppa:ondrej/php5-oldstable
  2. sudo apt-get update
  3. sudo apt-get install php5

that's it.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.