PHPRO.ORG

Currently the upgrade path for PHP 7 is managed by Ondřej Surý (note the utf-8 characters in his name), and PPA (Personal Package Archives) have been made available for ubuntu.

Installation, or upgrade begins with adding the PPA to apt, so that apt knows where to look for the packages.

sudo add-apt-repository ppa:ondrej/php

Due to the UTF-8 characters in the name of the maintainer, a language pack may be required.

sudo apt-get install -y language-pack-en-base
sudo LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php

From here, the install, or upgrade is the same as with any apt-get installation. First, ensure the system is up to date.

sudo apt-get update

The update to PHP 7.

sudo apt-get install php7.0

In PHP 7, the old, deprecated mysql_* extensions have been removed. If you are using MySQL you will need this.

sudo apt-get install php7.0-mysql

All done. To test if the isntallation was successful, simply test the version.

$ php -v
PHP 7.0.2-2+deb.sury.org~trusty+1 (cli) ( NTS )
Copyright (c) 1997-2015 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies