After only recently realising we were running an ancient version of PHP – version 5.3, we thought it a good time for an upgrade. CentOS has always been an advocate of don’t fix what is isn’t broken, rather than adopting the cutting edge. We hope this article will help you upgrade to PHP 7 on CentOS 6.

Much to our luck we eventually came across an article going over the details of setting up PHP 7 on a CentOS Virtual Private Server (VPS), I’ve included a link to said article at the bottom of this post.

Installing PHP 7

The upgrade to PHP 7 went surprisingly smoothly. The first requirement was to remove the currently installed PHP Apache module. To do this we entered the following command:

yum remove php*

The above command removes all installed packages beginning with PHP, before you do this we do very much recommend you take a backup of everything first just in case anything goes terribly wrong.

The next step involves downloading the latest version of PHP 7, which at the time of writing this article is PHP 7.0.2. The following command downloads the latest PHP repository to your current directory:

rpm -Uvh

The final step assumes you will be using PHP for a standard WordPress installation, the command below will install PHP 7 along with OpCache and the PHP driver for MySQL:

yum install php70w php70w-opcache php70w-mysql

If everything has gone as expected a simple restart of your Apache server should result in a working PHP installation. To check whether your upgrade to PHP 7 has worked correctly, we recommend running the phpinfo(); function.


As we use CloudFlare to aggressively cache our blog’s pages, upgrading to PHP 7 had very little impact on our frontend performance. Those of you who aren’t currently using a CDN or some form caching should see their page loading times half.

Having said the above, our WordPress admin, which isn’t cached, is certainly much more responsive.