24

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

  • 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
34

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.)

  • Thanks @Thomas W - looking back at the php.net 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
  • 2
    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
2

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
0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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