How to setup / install PHP 5.6 on Ubuntu 14.04 LTS
Ubuntu 14.04 LTS ships with PHP 5.5 by default, but if you want to use PHP 5.6, then it’s just 3 lines on the command line away. Please note that this tutorial is for installing on a fresh and untouched Ubuntu 14.04 LTS, not for updating an existing installation of PHP. This works perfectly on every tested Ubuntu 14.04 LTS.
1. Add PHP 5.6 package sources to your system:
sudo add-apt-repository ppa:ondrej/php5-5.6
and confirm with ENTER. If you get an error here, you need to install python-software-properties first (and then do the line above again):
sudo apt-get update sudo apt-get install python-software-properties
2. Update
sudo apt-get update
3. Install PHP
sudo apt-get install php5
and confirm with “y” and ENTER. You’ll now already see “PHP 5.6.x” in the scrolling installation logs. To properly check the installed version of PHP do:
php5 -v
Voila! By the way, this extremely-easy-to-install PHP 5.6 package was created by Ondřej Surý, so consider donating him a beer or a coffee via his donation page.
Remove installed PHP and manually install PHP
Actually the PPA has been renamed and is obsolete. The new one is ppa:ondrej/php
See https://launchpad.net/~ondrej/+archive/ubuntu/php for reference
php5 -v
is this the right command?
The right command for what ?
Thanks very helpful. Btw on Ubuntu 14.04 after I ran “apt-get install python-software-properties” still got error “apt-get-repository Command not found”. Needed to install “apt-get install software-properties-common” … then it worked
nice blog,
I am really impressed with your writing skills and also with the layout on your
blog. Is this a paid theme or did you modify it yourself?
Either way keep up the excellent quality writing,
it’s rare to see a nice blog like this one nowadays.
soap does not work? any help
Worked great, thank you!
Also, you’ve got the wrong dontation link for Orej, it’s https://donate.sury.org
That PPA (ondrej/php5-5.6) is now deprecated. You should use this one instead:
$ sudo add-apt-repository ppa:ondrej/php
And then, update and install:
$ sudo apt-get update
$ sudo apt-get install php5.6
Yes, please update the ppa to:
sudo add-apt-repository ppa:ondrej/php
http://stackoverflow.com/questions/40567133/cannot-add-ppa-ppaondrej-php5-5-6
Obrigado!
thanks
Thanks!
This doesn’t seem to have php-fpm???
thanks, it worked for ubuntu 14.04
Worked perfectly. But it doesn’t depend on `python-software-properties`.
The command `apt-get install php5` runs on my ubuntu-15-minimal successfully.
Thanks, it helps a lot ;)
Didn’t help. I get php 5.2 installed.
got the same
$ php -v
PHP 5.3.10-1ubuntu3.22 with Suhosin-Patch (cli) (built: Apr 20 2016 12:31:15)
They went away but was getting these quite a bit earlier, mmmkay:
Cannot access PPA (https://launchpad.net/api/1.0/~ondrej/+archive/php5-5.69) to get PPA information, please check your internet connection.
I did all this. and it says php5 already installed. i tried to update too. but still php 5.5.9
Hmmm. Received an error on the initial command, then did the
‘sudo apt-get update’
That generated this error:
…
Reading package lists… Done
W: GPG error: http://ppa.launchpad.net trusty Release: The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY 4F4EA0AAE5267A6C
Never had an error on ‘apt-get update’ before. Did 1st command cause this? Then
‘sudo apt-get install python-software-properties’ updates nothing.
Wow. I had done a `apt-get install lamp-server^` and realised it was 5.9. I needed 5.6 (that `foo(…$args)` is quite useful :D) and saw your article, did as instructed, expected everything to break, but no! No Apache configuration change, no need to restart Apache, just refreshed my `phpinfo()` page and the version had changed. Amazing job by the creator of this repo!
You rock dude
Perfect. Thanks!
Unfortunately doesn’t work on my raspi… any suggestions?
W: Fehlschlag beim Holen von http://ppa.launchpad.net/ondrej/php5-5.6/ubuntu/dists/wheezy/main/source/Sources 404 Not Found
W: Fehlschlag beim Holen von http://ppa.launchpad.net/ondrej/php5-5.6/ubuntu/dists/wheezy/main/binary-armhf/Packages 404 Not Found
The warnings are (half) in german, but what they say is that the packages could not be found…
However it is working on my Ubuntu system, therefore i have no idea whats wrong with the raspberry.
Fantastic. Worked perfectly. Thanks!