47

Is there an easy way out to get the latest PHP? I have tried updating my package but none of it has 5.4.6 yet... if anyone knows on how to do it quickly, can it be shared here?

I've tried compiling from the source, but I am constantly getting:

 configure: error: Cannot find OpenSSL's <evp.h>.

In my ./configure I've specified where evp.h is, --with-openssl=/usr/include/openssl \.., but still it gives me, that error

3 Answers 3

94

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

You may need to install add-apt-repository on Ubuntu 12.04. To do so, run the command:

sudo apt-get install python-software-properties

Other New Versions

For PHP 5.5 (currently 5.5.30) add the PPA repository instead:

sudo add-apt-repository ppa:ondrej/php5

For PHP 5.6 (currently 5.6.14) add the PPA repository instead:

sudo add-apt-repository ppa:ondrej/php5-5.6
13
  • seems like this is not the latest 5.4.6?
    – user79356
    Aug 22, 2012 at 9:42
  • 3
    wow....that worked!!! Apr 2, 2013 at 7:06
  • 6
    Ubuntu 10.04 LTS: sudo: add-apt-repository: command not found
    – Hubro
    May 29, 2013 at 9:52
  • 7
    @Codemonkey and future people with same problem, you can run apt-get install python-software-properties to be able to use add-apt-repository
    – Moak
    Jun 5, 2013 at 3:11
  • 5
    @Moak or they just use the correct program name: apt-add-repository which is pre-installed in current Ubuntu ditributions
    – feeela
    Sep 18, 2013 at 9:46
10

Hai Look at the following page to update PHP 5.4 in Ubunthu

http://www.zimbio.com/Ubuntu+Linux/articles/D_AsJR2qAL6/How+Upgrade+PHP+5+4+Ubuntu

You can update by apt-get command in terminal. Open Terminal and login to su user . then try the following command to update

add-apt-repository ppa:ondrej/php5
apt-get update
apt-get install php5

If you try in local user means, use sudo before all commands...

WARNING: - this will also auto-upgrade Apache (now 2.4) which has additional consequences, i.e. there are big config changes between Apache 2.2. and 2.4 that will prevent the Apache service from running afterwards!

1

If the official Ubuntu repositories aren't updated (and I do not think they are yet, latest PHP version available should be 5.3.x), you'll have to download the source files and compile it yourself.

See: http://www.php.net/manual/en/install.unix.php

3
  • I actually tried that and got stuck with this error: configure: error: Cannot find OpenSSL's <evp.h>. In my configure I've specified where evp.h is is, --with-openssl=/usr/include/openssl \.. but still it gives me that error
    – user79356
    Aug 22, 2012 at 9:26
  • I'm sorry, I've never tried to manually build the php sources under linux. If it is not urgent, I'd recommend to wait for the official package to be updated, I do not think it'll take much longer. EDIT: try installing openssl-devel as suggested here: webhostingtalk.com/showthread.php?t=184406
    – Matteo Tassinari
    Aug 22, 2012 at 9:29
  • @adit Always when you see something like "Cannot find foo.x", try ubuntus package search packages.ubuntu.com
    – KingCrunch
    Aug 22, 2012 at 9:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .