With the release of PHP 7 growing ever closer, you must be asking yourself whether or not it’ll be worth upgrading your WordPress installation. In many ways, PHP 7 is being touted as the biggest upgrade of the framework since release 5.3. However, it’s still in Beta and so we wouldn’t want to use it on any live sites. But why not run a quick test to see how much better it actually is? Moreover, is it compatible with all of your plug-ins?
One of the web hosts offering PHP 7 as a Beta version is SiteGround. Though it’s not it compatible with their Memcached solution, users can enable it right away from the PHP version manager.
I bit the bullet and tested out PHP 7 on my own website. While I ran into a few problems regarding plug-in compatibility, I found it to be overall significantly faster than PHP 5.6 which I was using earlier. Just to create a baseline comparison, here is the complete page load time of one of my blog post articles using PHP 5.6:
Keep in mind that this load time of 5.9 seconds doesn’t reflect the actual experience of the visitor. Instead, the “start render” metric reflects the time when the visitor actually begins to see the page. So let’s see how to enable PHP 7 and what we need to do to prepare our site for it.
Preparing for PHP 7
If you’re using SiteGround like I am, and you’re also using the SuperCacher functionality, you need to disable Memcached by navigating to the SuperCacher icon, clicking the “Memcached” tab, and changing the setting to “off” as shown here:
Once you’ve done this, head over to your WordPress installation and navigate to the corresponding plug-in that you must have installed. Go to the SuperCacher settings and under “Memcached Settings”, change the switch to “off”.
If you heavily customized your WordPress site, chances are that PHP 7 is going to break some of your plug-ins. I personally had to deactivate three or four of them which had custom code. But the biggest conflict I had with PHP 7 and WordPress is that it broke my “Bad Behavior” plug-in which I rely upon heavily for preventing spammers and hackers getting on my site. So for now, I had to disable it in order for PHP 7 to be compatible.
Switching to PHP 7
Switching to the new version of PHP via the SiteGround cPanel area is extremely easy. Click the “PHP Version Manager” icon in your cPanel dashboard and then select your WordPress folder – there’s no need for us to change the PHP version for anything else right now. This will take you to the next screen which will allow you to choose which PHP version you want to enable.
As shown in the screenshot above, my previous version was the one in bold – 5.6 .12. Over here, simply change your selection to PHP 7 Beta, hit “Save”, and you’re done! The first thing to do is to immediately check your site for error messages. In case your site breaks and you have no error messages, you can find out what they are by following the instructions in this blog post. If like me you see a bunch of error messages complaining about various plug-ins, go ahead and disable them temporarily while you test out PHP 7.
Running the Benchmarks
Since I had disable some plug-ins, I ran the old test again with PHP 5.6 and after switching to PHP 7, here are the results:
You can see that there is a difference of more than one second when it comes to page load times for my existing site. That’s a 20% difference! In addition, keep in mind that we’ve disabled Memcached on the SiteGround servers. These are extremely promising results and once the bugs and compatibility problems with PHP 7 are ironed out, I’ll be looking forward to making the switch full time.