UPDATED: on Ubuntu 15 (.04 and .10), the default PHP version is the 5.6.
On Ubuntu 14, now the default PHP version is the 5.5.

Q: When will PHP 5.6 be in the official Canonical repos?
A: Probably never.

This question was answered by Marc Deslauriers, security engineer at Canonical, and make sense since Canonical point of view about server updates are: stability, security, and updates-that-doesn’t-broken-legacy-code comes first. They don’t want to update because PHP 5.5 syntax are significantly different than 5.3.

So, what we can do if we need or want newer versions than 5.3? An option is to install by compiling the source code, which is awful to maintain. Another option is to install by some rpm found on internet, which not only is hard to maintain, but also probally won’t work without some black magic and many updates to our core system libraries.

Luckly, Ondřej Surý created a non-official PPA that provides an easy way to install and maintain PHP 5.6 (or 5.5, 5.4, and so on).

Our recipe:

1. We need Apache 2.4:

check your version with:

which means that you are using the 2.4 version. If you are using a version lower than 2.4, you need update to 2.4 (“sudo add-apt-repository ppa:ondrej/apache2”).

WARNING: if you update to 2.4, be aware that you will need to review all of your configurations since the structure and syntax are not fully compatible.

2. Remove the old PHP, install the new PPA and reinstall PHP:

3. Create a test site:

4. Create the Apache .conf file (don’t forget the “.conf” extension!)

5. Enable the site and restart Apache:

6. Open the site in your browser and check if its all working

By this way our PHP site will work as an Apache module. The other way is to do via FastCGI, which I intend to learn another day.