Sponsored

Not the solution you were looking for?

We’ll help you out!

Upgrade PHP 5.3 to PHP 7.0 using yum on CentOS/RHEL/Fedora

My web server was running PHP version 5.3 for a long time and now I would like to en-cash the advantages of PHP 7.0. So I decided to upgrade PHP 5.3 to PHP 7.0. As this is a production web server, I don’t want to disturb the existing setup and also, I don’t want to have multiple versions on PHP installed. So it should be a pure upgrade of PHP.

MySQL Original API deprecated in PHP 7.0 - Use MYSQLi

Make sure your MySQL DB connections are adhering to the standards supported in PHP 7.0. For e.g., The MySQL original API has been deprecated in PHP 7. So mysql_connect() should be replaced with mysqli_connect() and so on.

Here is a quick guide to help you upgrade default PHP provided on Fedora, CentOS, RHEL to latest version 7.0 (at the time of writing this article).

Don't Panic if upgrade fails, it may be due to incompatible extensions.

The upgrade may fail due to already installed extensions that may not be compatible with PHP 7. Check for the PHP extensions and versions compatible with PHP 7.0 from here. If the extensions are not mandatory, you can either remove them before upgrade or else, be patient.

Step 1: How to configure Remi repository in CentOS/Fedora/RHEL

Additional Repositories with Remi

On Fedora, standard repositories are enough, whereas on RHEL/CentOS, the EPEL repository must be configured and on RHEL the optional channel must be enabled.

Fedora 23

Step 2: Activate Remi repository

By default, Remi-safe repository would be enabled and remi-php70 would be disabled. If you want to enable it permanently, open the file /etc/yum.repos.d/remi.repo and change the value of enabled from 0 to 1 under remi-php70 section.