WordPRess Optimisation checklist #3: Use PHP 7

One of the best ways to speed up your WordPress website ... use PHP 7!

Recently I cut the average load time of a website in half (from 12 seconds to 5 seconds) by making one single change! 

That change was to use PHP 7 instead of PHP 5.6.

If you’ve downloaded the checklist we use when optimising client sites (you can get it here), you’ll have noticed that “Use PHP 7” is pretty near the top of that checklist.

There’s a good reason for that.

What's PHP?

Why is this item so prominent on our speed checklist?

Because WordPress is written primarily in PHP.

PHP is a general purpose programming language primarily used for website development.

Some PHP statistics

  1. PHP was released in 1994 by programmer Rasmus Lerdorf to make his website easy to update.
  2. PHP is now the most popular server-side (i.e. it runs on your web server) scripting language used today. It powers 82% of the internet.
  3. PHP runs WordPress, the most popular content management system (CMS), which runs 32% of websites.
  4. It’s powerful - FaceBook, Etsy, Tumblr, Badoo are built using PHP.
  5. It’s relatively easy for beginners to learn and edit.
  6. It’s open-source and free to use.
  7. It's widespread & popular; most hosting providers will have current versions of PHP.
  8. It’s scalable, so reliable for small sites as well as bigger sites.
  9. It works on all platforms.
  10. It’s relatively fast since uses its own memory, saving server resources and increasing page speed.
  11. It’s relatively secure.

How PHP is used in WordPress

So where does PHP fit into WordPress? WordPress is basically a huge collection of PHP scripts plus some JavaScript and CSS.

When someone visits your site, their browser contacts your web server. A web server stores and delivers your web pages to visitors.

The PHP code of your WordPress website runs. Using data from your WordPress database it produces the web page written in HTML and styled with CSS. This is what's shown in the visitor's browser.

wordpress dynamic page from wikipedia

from Wikipedia

A Brief Programming Primer

HTML is the language used to display the contents of a web page in your visitor’s browser.

MySQL is the database used by WordPress.

PHP reads data from this database and writes it out in HTML so that it can be displayed in the browser.

Although WordPress recommends running the latest version of PHP, version 7, many WordPress sites are still running on PHP version 5. 

PHP version Statistics WordPress

PHP versions used on WordPress sites as of November 2018

Benefits of PHP version 7 i.e. why you should use PHP 7

Apart from the security aspect just mentioned, why all the fuss about PHP version 7?

  1. The main benefit to you as a WordPress user and of course to your website visitors is speed. Depending on your source, PHP 7 can run 2 to 4 times faster than version 5.6. On a web where every second counts (Google recommends your page loads in less than 2 seconds!) that's not trivial.
  2. It can handle multiple visitors better without performance reduction for those visitors.
  3. It has improved code structure (e.g. type declarations) meaning better coding standards. This helps improve programming standards everywhere, including for WordPress themes and plugins.
  4. Better error handling. PHP used to stop dead when it hit an error. Now it can be programmed to deal with those errors instead.
  5. It has more security features.

Some older versions of PHP are still supported but unstable, full of security problems and not very fast.

In general, software updates mean improvements.

So it seems there's good reason to recommend using PHP version 7.

If you don’t upgrade to PHP 7

Looking at it from the other angle, if you don’t upgrade to PHP 7:

  • Your site will be slower.
  • The many known security issues in PHP 5.x are a potential threat.
  • Regularly updated WordPress plugins may stop working with older versions of PHP.

So, it's pretty clear that it's to your advantage to use PHP 7.

How to see what version of PHP you’re running

To get there, the first step is to check what version your website is using right now.

Use a plugin to check PHP version 

The easiest way for most WordPress users is to use the Display PHP Version plugin

The plugin adds a line in your WordPress dashboard telling you which version of PHP your site’s using.

Display PHP Version plugin

Simply install the plugin, read the PHP version, then remove the plugin again as you no longer need it.

​Use cPanel to check PHP version 

Your hosting account should list the PHP version somewhere. 

For example, on Siteground I can see what version of PHP I'm using vie the PHP Version Manager icon from within my cPanel.

find php version cpanel

On GoDaddy's cPanel, they have a similar icon named Select PHP version.

godaddy select php version

Check with your hosting provider’s support if you aren’t sure where to find this.

Note: PHP version 5.6. is the minimum version any host should be providing. If yours doesn’t, find a better host immediately. We recommend Siteground for the best cost to performance ratio.

Before you switch

At this stage it might seem like a no-brainer to switch to PHP 7. Yes, the benefits of switching far outweigh staying with an older version. BUT, only if PHP 7 works on your site!

Why wouldn't it work, you ask?

Well, a plugin or a theme you use on your site might be written in such a way as to use something in an older version of PHP that no longer exists in PHP 7. This is why it's important to keep ALL parts of your WordPRrss website up to date.

As you know by now, every website is unique. What works on my site may not work at all well on yours. Before making any changes to the components underlying your website, you’ll need to verify if your site will still work fine with PHP 7!

The easiest way to find out is again to use a plugin. Use this plugin from WP EngineNote that this plugin can’t be 100% reliable, but it’s a good indicator. 

(Ultimately, the best approach is to make a copy of your site and test it for PHP 7 compatibility that way. But of course not everyone can or wants to go to these lengths.)

If unsure, get help from your host or your developer. OR just ask us in the comments below - we've moved lots of sites to PHP 7.

How to Switch

The first step, as always, is to make a good working backup of your site!

(As I mentioned, the ideal method is to make a copy of your site to test. If you’re interested in this you can run a version of your site on your own computer to test. Use a setup like Local from Flywheel, XAMPP or Wampserver.)

The exact steps to follow depends on your host but usually the actual switch is pretty simple.

  • If you use cPanel, you’ll often have an icon named something like PHP version just click it and select PHP 7.
    Here's how I change it in my Siteground cPanel:

  • If you use shared hosting changing your PHP version should be similar to one of these ...
  • If you use managed WordPress hosting please ask their support as they handle things differently.

If for any reason you can’t switch 

IF you can't find how or where to change to PHP version 7 and your hosting provider can't help you, all isn’t lost just yet. WordPress will continue to support older versions of PHP.

But my advice would be to find a better host. A host that prevents you from using the latest software isn’t worth thinking about. And it certainly isn’t worth giving your money to them.

Note: Security support for PHP version 5 ends in December 2018.


The general rule for any software update applies here: it’s best to use the latest version. Just make sure it works for your particular setup first.

If you’ve ever asked yourself “Should I use PHP 7?” the short answer is yes. You should. 

If you have never asked yourself that question, then the answer is still yes. You should use PHP 7.



  • by Seán
  • |
  • October 30, 2018
Click Here to Leave a Comment Below

Leave a Comment: