Tell me more ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am trying to update to php 5.4 in Ubuntu 12.04, and I can only get 5.3.6 using official repositories (using apt-get).

I'm not really sure how to do a manual update – I'm sorta new to ubuntu, but I need to play around with the new php features!

share|improve this question

3 Answers

up vote 82 down vote accepted

You could use a ppa to stay up-to-date with php. I use :

https://launchpad.net/~ondrej/+archive/php5 Launchpad logo

It's now on 5.4. If you want use this ppa do this:

ppa:ondrej/php5 Launchpad logo (Click here for instructions on using PPAs.)

sudo add-apt-repository ppa:ondrej/php5
sudo apt-get update
sudo apt-get upgrade

If you don't have add-apt-repository binary do the following:

sudo apt-get install python-software-properties

Precautions:

For Ubuntu 12.10

Ubuntu 12.10's official repository is updated to php 5.4. You should use the main repository package if you can. To do this, just install php5 Install php5 without enabling any PPA.

share|improve this answer
3  
Turns out you gotta run sudo apt-get update first! – kavisiegel Mar 5 '12 at 21:40
3  
there is the php5-cli package for that! – matteosister Mar 7 '12 at 21:17
1  
After adding the ppa, you could do: sudo apt-get dist-upgrade – matteosister Sep 23 '12 at 8:03
1  
After installing the ppa, upgrading php and running php -v, the version information starts with this error message: Failed loading /usr/lib/php5/20090626/xdebug.so: /usr/lib/php5/20090626/xdebug.so: cannot open shared object file: No such file or directory Annoying. – systemovich Oct 24 '12 at 11:55
1  
that's normal. Php 5.4 uses a new version of the zend library. When you upgrade to 5.4 the xdebug extension gets recompiled. You need to check inside /usr/lib/php5 the name of the folder. Mine is 20100525, should be yours too, and check if there is a xdebug.so file. Now edit the xdebug.ini file in /etc/php5/mods-available/xdebug.ini (or the symlinked /etc/php5/conf.d/**-xdebug.ini) and set the correct path to the xdebug.so file – matteosister Oct 24 '12 at 15:14
show 7 more comments

It will take some time for PHP 5.4 packages to make their way into Ubuntu, as there are an awful lot of dependency checks to do. Ubuntu 12.04 is now in beta so I doubt they'll upgrade it to PHP 5.4 (although I have no official or inside knowledge of this) -- it probably won't appear until Ubuntu 12.10 in October this year. If you want it sooner than that, you'll either have to find a third-party package or learn to build it yourself from the source code.

share|improve this answer

Here's what I understand that you have to do (Type these commands in the terminal):

curl http://apt.damz.org/key.gpg | sudo apt-key add -

Someone asked about PPAs and Ubuntu ( What are PPAs and how do I use them? ), and they share how to add a repository line. Here's the repository line you need:

deb http://apt.damz.org/ubuntu natty php54

After all of this, just do the following two commands and you should be all set!

sudo apt-get update
sudo apt-get install php5 libapache2-mod-php5
share|improve this answer
17  
Downvote. There is no way to know who "damz.org" is, At least PPAs have a trust mechanism in that they must have a launchpad account which can be evaluated using karma. I don't know "Damien TOURNOUD", but for all we know these are fully trojaned PHP packages. – SpamapS Apr 27 '12 at 20:43
1  
"For all we know"..? I wouldn't go around insinuating trojaned packages if you don't have a good reason to. It hurts your credibility if you can't back it up with facts. If someone wants to add his or her own repository to host an experimental package, then it's up to those people to do so. I looked around at the code that I posted, and there are quite a few sources using that repo. Personally, I've used that repo, and never had a problem with it. Of course we could all be wrong, and 'for all we know these could be fully trojaned PHP packages.' – willbeeler Apr 28 '12 at 1:57
11  
I don't mean to disparage Mr. Tournoud, only to point out that there is no real way to verify his identity or know who you are trusting w/ root on your box. The GPG key used to sign the repo is not signed by any real keys. The domain may be linked to by some users, but that just proves that the repo is well known, not that the contents are at all reliable. I would suggest that the owner sign their signing key, and expand the web of trust of their own key so that one can do some kind of verification of his identity in the same way one can do for a Launchpad user or the Ubuntu archives. – SpamapS May 5 '12 at 7:16
2  
I agree with SpamapS; I was just wondering the "source" of that website. damz.org loads a blank page, which doesn't help... – Rafa Jul 10 '12 at 7:55
2  
@SpamapS Karma is not really for evaluating the trustworthiness of an LP account. It decays automatically--it's a measure of how currently active someone is. It's different from reputation here (and when making decisions about what to run on your computer, you should take AU rep with a big grain of salt too). You can look at what people have done on Launchpad to help decide if you should trust their repository, but this is not really different from the rest of the Internet. The key reason damz.org is cause for concern is that no clear evidence has been presented that it's legitimate. – Eliah Kagan Mar 1 at 23:50
show 1 more comment

Your Answer

 
discard

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.