How to upgrade php 5.5 to 5.6 on Ubuntu 14.04 LTS

By Cris, November 12, 2016
Last updated: January 22, 2017

Upgrade your server’s php installation from 5.5.x to 5.6.x on Ubuntu 14.04 LTS

The standard Ubuntu 14.04 LTS Server installation maintains PHP 5.5.x. Upgrading your PHP installation potentially speeds up your installation and provides the latest new features.

Begin by adding Ondřej Surý’s newest (as of 2016) PPA repository and updating sources as follows:

sudo LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
sudo apt-get update

Next we should list all existing php 5.5.x packages (so we know which equivalent version need to be loaded for 5.6.x):

Warning: This has been tested with Ubuntu 14.04 LTS and PHP 5.5.9 and might be valid for this release only! Use at your own risk!

Issue the following command:

dpkg --get-selections | grep php

This example gave the following output:

dpkg --get-selections | grep php

libapache2-mod-php5                             install

php-pear                                        install
php-xml-parser                                  install
php5                                            install
php5-cli                                        install
php5-common                                     install
php5-curl                                       install
php5-dev                                        install
php5-gd                                         install
php5-intl                                       install
php5-json                                       install
php5-ldap                                       install
php5-mcrypt                                     install
php5-memcache                                   install
php5-memcached                                  install
php5-mysql                                      install
php5-pgsql                                      install
php5-readline                                   install
php5-sqlite                                     install
php5-xsl                                        install
pkg-php-tools                                   install

Download the php5.6.x versions them like so:

sudo apt-get install php5.6 php5.6-cli php5.6-common php5.6-curl php5.6-dev php5.6-gd php5.6-intl php5.6-json php5.6-ldap php5.6-mbstring php5.6-mcrypt php5.6-memcache php5.6-memcached php5.6-mysql php5.6-pgsql php5.6-readline php5.6-sqlite php5.6-xml php5.6-xsl libzip4 php5.6-zip

Apt might also include a few additional packages, proceed (Y). Next disable the php5.5 apache2 module and load the php5.6 apache2 module in its place. However, you should consider adding the compatibility PPA maintained by Ondřej Surý before restarting your apache2 server.

sudo apt-get update && apt-get upgrade
sudo LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php5-compat
sudo apt-get update
sudo apt-get dist-upgrade
sudo a2dismod php5.5
sudo a2enmod php5.6
sudo service apache2 restart

All done 🙂

If you would like to support Ondřej Surý and his efforts, visit his donation page for a away to do so!

The official PHP Migration (5.5.x to 5.6.x) Notes can be found here. Additional migration details, change logs, new/ deprecated features for all other migrations are also present.

This guide was compiled into one using pieces (new and old) from:

What do you think?

Leave a Reply

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.