I am trying to update to install PHP 5.5, 5.6 or 7.0 in Ubuntu 12.04/14.04/16.04 LTS, and I can only get PHP 5.3.10 for Ubuntu 12.04, PHP 5.5.9 for Ubuntu 14.04 or PHP 7.0.4 for Ubuntu 16.04 using official repositories (using apt-get).
I'm not really sure how to do a manual update – as I need:
- to play around with the new(est) PHP features
- to install older PHP version due support in the software
You could use a PPA to stay up-to-date with PHP or install previous version of PHP (f.e. PHP 5.6 on Ubuntu 16.04 LTS).
The most widely used repositories come from Ondřej Surý, the Debian PHP maintainer:
The php5 compat packages:
php5
to satisfy dependencies in the old packages)(Click here for instructions on using PPAs.)
PHP PPAs previously contained Apache 2.4 update. This is no longer a case, you need to add separate Apache 2.4 repository:
If you want use these PPAs, do this:
ppa:ondrej/php (for PHP 5.6/7.0/7.1)
To switch between installed versions use
Then you must set Apache to work with right version:
ppa:ondrej/php5-compat (for php5 compat)
If you don't have
add-apt-repository
binary do the following:Precautions:
php.ini
.PHP 5.4
Prepackaged latest PHP 5.4 now resides in separate PPA: ppa:ondrej/php5-oldstable
Please be aware that PHP 5.4 has reached its end of life on 3. September 2015 and it doesn't receive any security updates. It's recommended to migrate to at least PHP 5.6 that will receive security updated till 31. December 2018.
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.