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?

Published by

Bjørn Johansen

Bjørn has been a full-time web developer since 2001, and have during those years touched many areas including consulting, training, project management, client support, and DevOps. He has worked with WordPress for more than 13 years, and he is a plugin author, core contributor, WordCamp speaker, WordCamp co-organizer and Translation Editor for Norwegian Bokmål.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.