PHP 5.6 on Ubuntu

PHP 5.6 is the latest stable version of PHP available. The latest stable version of PHP available for Ubuntu is PHP 5.5.x, If you want to PHP 5.6 or upgrade your existing PHP 5.x install to 5.6 follow this guide. PHP 5.6 can be installed using a PPA which makes it even easier to install or upgrade to PHP 5.6.

Installing

  • We need to add the PHP 5.6 PPA to our local repository database.
sudo add-apt-repository ppa:ondrej/php5-5.6  

Updating our local repository database.

sudo apt-get update  
Code language: JavaScript (javascript)

Installing PHP 5.6

sudo apt-get install php5  
Code language: JavaScript (javascript)

All the extension that were available for PHP 5.x is available for PHP 5.6 and can be installed in the same old way as all other PHP extensions are installed using php5-extension name extension name

If you already have PHP 5.x and want to upgrade to PHP 5.6 you can run a dist-upgrade.

sudo apt-get dist-upgrade  
Code language: JavaScript (javascript)