Install latest version of PHP on Ubuntu

PHPI always run the latest LTS version of Ubuntu on all my servers. Currently the latest LTS is 14.04 which comes with PHP version 5.5, but as of November 2014, the latest stable version is 5.6. So how do you get an updated, current version of PHP without resorting to having to maintain the packages yourself? The answer is in PPA.

Updated November 3, 2014

PPA is an acronym for Personal Package Archives and is a means for users to to distribute packages and updates to other users.

First you need add-apt-repository which is in the python-software-properties package:

$ apt-get install python-software-properties

Then you add Ondřej Surý‘s repository for PHP 5.6:

$ add-apt-repository ppa:ondrej/php5-5.6

Finally, it’s as simple as doing a regular upgrade:

$ apt-get update && apt-get dist-upgrade

And you’re done :-)

Maybe you are also looking for how to install the latest version of Nginx?