Migrate PHP 5.6 to PHP 7.0

Migrate PHP 5.6 to PHP 7.0 – As we know PHP 7.0 hase been here for months. And, Most of the Distro’s are pushing stable update of PHP 7.0 to their repositories.So, it is really time for an upgrade.So this article is about how to Migrate PHP 5.6 to PHP 7.0 or older version of PHP to the latest version of PHP 7.0.

PHP 7.0 is a major version and a game changer.Performance is booted like the rocket in every PHP based frameworks.Also, PHP 7.0 place the on the top compared to Perl, Python, Ruby etc. I have done a detailed post about this on my blog, follow the link PHP 7 beats Ruby, Python, Perl, etc.

However, the efforts have been made to make the migration procedure as simple as possible.This version release mainly focuses on removing functionalities deprecated in previous versions of PHP and improving language consistency.

The following procedure is for Debian based Distro’s. If you are using RedHat based or Arch based Distro’s simple change the version number from 5.x to 7 (Worked perfectly on my Arch system, need testing on RedHat).

Adding a PPA for PHP 7.0 Packages:

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

After PPA is installed, update the local package cache to include its contents:

$ sudo apt-get update

Upgrading mod_php with Apache

Install the new packages using the following command:

$ sudo apt-get install php7.0

For MySQL, make sure to re-add the updated PHP MySQL bindings:

$ sudo apt-get install php7.0-mysql

Testing PHP Version

$ php -v

If you see the following output successfully, All Done.
Output
PHP 7.0.0-5+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

Note: Migrate PHP 5.6 to PHP 7.0 is not a tough procedure. Since, it improves the efficiency a lot, i recommend it extremely.