PHP 5 to PHP 7 CentOS

Upgrade PHP 5 to PHP 7 on CentOS/RHEL 6/7

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.

Pre-requisite

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.

https://secure.php.net/manual/en/migration70.php

1. Install YUM Repository

CentOS/RHEL 7.x

CentOS/RHEL 6.x

1. Upgrade PHP

2. Install PHP 7

[Optional] APC

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.

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.

 

That’s it! You are done upgrading from PHP 5 to PHP 7.

Leave a Reply

Your email address will not be published. Required fields are marked *

three + 6 =