As we all know, PHP 7 brings 2x the increase in performance to PHP powered systems. The main purpose of this guide will be focusing on the steps to upgrade your web server from PHP 5 to PHP 7 on CentOS.
If you are upgrading an existing system to PHP 7, it is advised to test your current system with this upgrade on a separate web server.
Check that your current PHP source codes is compatible with PHP 7 at the following link.
1. Install YUM Repository
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
1. Upgrade PHP
yum install yum-plugin-replace yum replace php-common --replace-with=php70w-common
2. Install PHP 7
yum install php70w php70w-opcache
If you have existing APC (Alternative PHP Cache) installed in your web server, you will have to remove it as APCÃÂ does not support PHP 7.
pecl uninstall apc
After uninstalling APC, modify the following file.
Comment the following line of code by adding a semicolon ‘;’ in front of it.
Check PHP Version
Run the following command to check your current version of PHP.
You should see the following.
PHP 7.0.0 (cli) (built: Dec 2 2015 21:42:51) ( 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
That’s it! You are done upgrading from PHP 5 to PHP 7.