[SOLVED] How to Upgrade to PHP7 in Ubuntu

Zyxware default image2

PHP 7 is promising substantial improvement in performance over previous versions of PHP, which was released on 2015, December 3rd. Those who are interested in using PHP 7, can easily update your PHP version.

Ondřej Surý is maintaining a PPA (Personal Package Archieve) for PHP 7 in Ubuntu.

You need to add the repository to your package list.

$ sudo add-apt-repository ppa:ondrej/php

Press 'Enter' key to proceed.

After installing PPA, need to update the local package cache to download its contents:

$ sudo apt-get update

Upgrade 'mod_php', with Apache. Install the new important PHP packages, with the exception of php5-mysql, that will be removed.

sudo apt-get install php7.0

For MySQL users, make sure to update the PHP-MySQL bindings:

$ sudo apt-get install php7.0-mysql

To verify the PHP version, run the following command in Ubuntu terminal,

$ php -v

You will be able to see the PHP version as below,

PHP 7.0.11-2+deb.sury.org ~ trusty+2 (cli) ( NTS )

Hope this helps!