Why You Should Be Using Supported PHP Versions

By Brian Jackson Updated on November 12, 2018
2.5K
Shares

PHP is one of the most popular scripting languages on the web today. According to W3TechsPHP is used by over 79% of all the websites who use a server-side programming language. This means for almost every 8 out of 10 websites you visit, they are most likely utilizing PHP in some form or another. And of course, it plays a very vital role as it pertains to the WordPress ecosystem, as the entire CMS is built on PHP.

A dilemma we are facing today is that many businesses, developers, and hosts have fallen behind when it comes to supporting the latest PHP versions. Some of the statistics below might even shock you. Today we want to discuss some of the reasons why it is so important that everyone uses the latest PHP versions, not only for security reasons but also for better performance and support.

Old PHP Versions

As with any piece of software, PHP has a release life cycle in which has to adhere to in order to keep pushing things forward and making improvements.  Each major release of PHP is typically fully supported for two years after its release. During that time, bugs and security issues are fixed and patched on a regular basis.

Still looking for that perfect WordPress host?

At Kinsta, we do hosting different than the rest. We’ve combined the fastest platform in the world (Google Cloud) with the best support team in the industry. Ready to take your site the next level?
Supported PHP Versions for WordPress

Supported PHP Versions

PHP 5.6 and PHP 7.0 End of Life

As of December 3rd, 2018, PHP 7.0 reaches its end of life. This means it will no longer have security support and could be exposed to unpatched security vulnerabilities. Following suit, as of December 31st, 2018, PHP 5.6 also reaches its end of life. This officially marks the end of an era for PHP 5, as the first version, 5.0 was launched 14 years ago.

According to the official WordPress Stats page, as of writing this, over 63% of WordPress users are still on PHP 5.6 or lower. If you combine this with PHP 7.0, a whopping 82.8% of users are currently using PHP versions that will no longer be supported come January 2019.

It’s even scarier if you look at the stats outside of the WordPress community. According to W3Techs, PHP 5 is currently used by 76.9% of all websites who use PHP.

82.8% of WordPress users are currently using PHP versions that will no longer be supported come January 2019. 😮 Click to Tweet

This is not only bad from a security perspective, but also because there is still a large portion of WordPress sites that aren’t taking advantage of the additional performance enhancements with PHP 7.

WordPress PHP version Stats

WordPress PHP version Stats

Why the Slow Adoption of Newer Versions?

The main reason for the lack of faster adoption for new versions most likely comes down a few different factors:

  • The number one reason we see from new customers that migrate to Kinsta is that business owners don’t know or care about their PHP version. This of course is understandable in some cases as we don’t expect everyone to know this.  Many times this responsibility falls on the developer, agency, or host.
  • It takes time for developers to update their code to support newer versions of PHP. This includes those that develop websites, themes, plugins, etc.
  • Not only does it require effort and time to update code, it also can require extensive testing to ensure compatibility. The WordPress repository alone has over 49,000 plugins!
  • Many WordPress hosts have been reluctant to push out updated PHP versions because this could end up resulting in additional support tickets if it breaks a site. As a WordPress host we definitely understand this, but from our experience, this is typically the other way around. Many support issues we see are from issues caused by older PHP versions.
  • The developer or agency might be stuck between a rock and a hard place when dealing with a client and other 3rd party applications they are unwilling to spend resources on updating.

However, with all that being said, it is still not an excuse to run on PHP versions that are out of date, not supported, and actually could be slowing your WordPress site down. The good news is that there is some progress being made.  Jordi Boggiano, co-founder of Private Packagist, puts together a report each year on PHP usage statistics. And as you can see below, there is some movement forward. This is of course just a sample subset of Composer installs, but still interesting to see the changes.

php usage statistics

PHP usage statistics – compiled by Jordi Boggiano

Reasons Why You Should Update PHP Versions

Check out some of the reasons below why you should think about updating if you haven’t already.

1. Security

One of the most important reasons to update PHP is to ensure you are running on a version that is fully supported and patched regularly for security vulnerabilities. PHP 5.4 has not been patched since 2015. And PHP 5.5 has not been patched since 2016. It is important to note though, that some operating system vendors still update older versions of PHP if they included it.

According to CVE Details, 2016 was one of the worst years for PHP security vulnerabilities, with over 100 issues reported. These included DoS, code execution, overflow, memory corruption, XSS, directory traversal, bypass, and gain information types. 2017 was the third-worst year since 2,000, with over 40 vulnerabilities.

PHP security vulnerabilities by year

PHP security vulnerabilities by year

Even PHP themselves give some feedback about staying current:

PHP, like any other large system, is under constant scrutiny and improvement. Each new version will often include both major and minor changes to enhance security and repair any flaws, configuration mishaps, and other issues that will affect the overall security and stability of your system. Like other system-level scripting languages and programs, the best approach is to update often, and maintain awareness of the latest versions and their changes. PHP, Keeping Current

2. Performance

With the release of PHP 7.0 (and 7.2) came huge performance gains! So big in fact, that it should be a priority over a lot of the small optimizations you might playing around with on your WordPress site. The following benchmarks demonstrate significant performance improvements with PHP 7 over its previous iterations. PHP 7 allows the system to execute twice as many requests per second in comparison with the PHP 5.6, at almost half of the latency.

php 5.6 vs php 7

PHP benchmarks by Rasmus Lerdorf, PHP Fluent Talk

We also ran our own performance benchmarks in 2018 with PHP 5.6 vs PHP 7 vs HHVM. And similarly to the benchmarks above, we saw that PHP 7.2 could execute almost three times as many transactions (requests) per second as compared to PHP 5.6.

WordPress benchmarks

WordPress benchmarks

  • WordPress 4.9.4 PHP 5.6 benchmark results: 49.18 req/sec
  • WordPress 4.9.4 PHP 7.0 benchmark results: 133.55 req/sec
  • WordPress 4.9.4 PHP 7.1 benchmark results: 134.24 req/sec
  • WordPress 4.9.4 PHP 7.2 benchmark results: 148.80 req/sec 🏆
  • WordPress 4.9.4 HHVM benchmark results: 144.76 req/sec

Christian Vigh also published a PHP performance comparison in which he found that PHP 5.2 was 400% slower than PHP 7.

cpu benchmarks php versions

Comparison of pure CPU benchmark results

And if we look ahead, early benchmarks are showing that PHP 7.3 is about 5% faster than PHP 7.2.

3. Support

Support is another reason why you want to use the latest and supported PHP versions. Many times, developers of plugins and themes can only extend support back for older versions so far. A lof this is due to time constraints and not having time to test compatibility. Things will eventually break when you run on old versions, and you can see this happening first hand in the WordPress forums. Here is a common error, which is typically caused by an older PHP version and how it treats a certain function:

Parse error: syntax error, unexpected ‘’ (T_VARIABLE), expecting function (T_FUNCTION) in /pub/file.php on line xxx

You can do a search in the WordPress forums for “unexpected T_Function” and it returns over 2,000 threads, many with results from within the last couple days. Here are just a couple recent ones, all due to running old versions of PHP:

Many of these threads are being opened due to the fact that they are running on outdated versions of PHP. However, the same could also be said for threads being open due to PHP 7 compatibility issues. Which shows that the WordPress development community is still trying to catch up with newer versions of PHP.

4. New Features for Developers

Most WordPress developers would prefer to only work on newer versions of PHP if they could, simply due to the fact that there have been so many new features added between PHP 5.2 and PHP 7.1. A few changes with PHP 7 and 7.1 include:

  • Combined comparison operator
  • Null coalesce operator
  • New type hinting
  • Anonymous classes
  • Nullable types
  • Iterable and void returns
  • Multi-catch exception handling
  • Keys usable in lists
  • More negative string offsets
  • Number operators and malformed numbers
  • HTTP/2 server push

It’s no fun to support old versions of anything. Unfortunately, a lot of developers are stuck having to support a wide range of versions.

Make Sure Your Host Supports the Latest PHP Versions

It took a while, but the official WordPress.org requirements now recommend a host running PHP version 7 or greater.

Yoast just recently published a great article called “Whipping Your Host Into Shape.” In the article, Joost de Valk goes into detail about how the real issue is that hosting providers aren’t adopting this faster, and even if they are, they aren’t encouraging users to upgrade. And Yoast is going to do something about it. As of Yoast SEO 4.5, they are going to start showing a notice on the WordPress dashboard for sites running on PHP 5.2.  This notice will be big, ugly, and non-dismissible.

PHP 7 is the future (and boy is it nice and fast). 🚀 -- Joost de Valk via @yoast @kinsta Click to Tweet

If we could give Yoast a high five, we totally would! Kinsta has supported the latest stable versions of PHP 7.1, and 7.2 ever since their stable releases. We are even letting users test with PHP 7.3-RC4.

In fact, every fresh WordPress install here at Kinsta defaults to PHP 7.2. And PHP 5.6 is the minimum version we allow in our environment. Note: We will be phasing PHP 5.6 and 7.0 out soon. We do not and will never host WordPress sites that are running on an unsupported version of PHP. We encourage people to move to 7.1 or higher for the best performance.

If your WordPress host is dragging their heels to release newer versions of PHP, we highly recommend you search for a new host. Feel free to contact us to see how we can help.

Check your Current Version of PHP

Perhaps you don’t know what version of PHP your WordPress site is currently on. Check out these different ways below to find out.

1. Check PHP Version with Pingdom

One of the easiest ways to check to see which version of PHP you are running is to use a tool like Pingdom or Google Chrome Devtools. The first HTTP request header will typically show you the version.

Check PHP version in Pingdom

Check PHP version in Pingdom

This relies on the host not modifying the X-Powered-By header value. Some might strip this due to security concerns. If they do, you might not see your PHP version, in which case you would need to use the second option below. Or you can always reach out to your host and ask.

Struggling with downtime and WordPress problems?

Kinsta provides an all-in-one hosting solution designed to save you time! Let us handle the nitty-gritty stuff (caching, backups, etc.), and you focus on what you do best, which is growing your business.

Check out our features

2. Check PHP Version With File

You can also check your PHP version by uploading a file via FTP to your server.

Step 1

Create a blank file called phpinfo.php. In the file, paste the following contents:

<?php
echo 'Current PHP version: ' . phpversion();
?>

Step 2

Upload the file to the root of your WordPress site.

upload phpinfo file

Upload phpinfo.php file

Step 3

Then browse to the location of your file, domain.com/phpinfo.php. You should then see a readout of your current PHP version.

check php version browser

Check PHP version in browser

What Should Less Tech-Savvy Users or Those Without a Budget Do?

We realize there are still thousands of WordPress sites out there that are incompatible with newer PHP versions, whether it be due to an old plugin or theme. The challenge is for the less tech-savvy users or those without a budget, what is the best course of action? We run into this all the time with clients who migrate to Kinsta and as PHP versions reach their EOL.

Here are some recommendations:

  1. This should be a given, but always update your plugins and themes to the latest version if you haven’t already.
  2. Reach out to the developer of the plugin or theme and ask them to add/fix support PHP 7.2 or 7.3 (or the current version you’re trying to update to). We give clients a heads up before phasing out PHP versions so they can have time to do this if needed. This is especially important for those without a budget to simply hire a developer.
  3. Find an alternative plugin that can deliver the same functionality and is compatible with the PHP version. Thanks to the massive WordPress repository and the thousands of premium plugins and themes out there, you can almost guarantee there is an alternative for everything.
  4. For those that have the budgets, hire a WordPress developer to fix the issue.

How to Update PHP

Ready to update? Great, but one of the very first things you should do is test your site to ensure compatibility. You could test your WordPress site locally or better yet, utilize a staging environment, as this will more closely resemble a live production site. It’s better to be safe than sorry!

If you are a Kinsta customer you can easily create a staging environment with a single click. Change the PHP version from the dashboard and start testing away.

WordPress staging environment

WordPress staging environment

And remember, if you are upgrading from an old version of PHP, ensure you are also upgrading your WordPress installation as well. A new version of PHP with a 2-year-old version of WordPress probably won’t end well. Once you have tested your site and are ready to update PHP, here are some resources to get you up and going fast.

Update PHP With Kinsta

If you are a Kinsta customer, you can easily change the version of PHP by clicking into your site, going to “Tools,” and selecting a different PHP Engine. We have PHP 5.6, 7.0, 7.1, 7.2, and 7.3-RC4 available. Note: We will be phasing out PHP 5.6 and 7.0 soon.

Change WordPress PHP version

Change WordPress PHP version

Update PHP from cPanel

If your host uses cPanel they most likely already have an option available to you to change your version of PHP. Simply login to cPanel and under the “Software” category click on “Select PHP Version.”

select php version

Select PHP version in cPanel

You can then select the PHP versions available to you that your host supports.

php 7 cpanel

PHP 7 in cPanel

Update PHP Manually on Server

If you manage your own server, we recommend checking out the official PHP installation documentation as instructions will vary per operating system. You’ll want look at the changes with functions, classes, wrappers, extensions, modules, etc. Here are a few links to migration guides:

Summary

Now is the time to think about upgrading to PHP 7.1 or higher if you haven’t already. Not only because you want to be running on supported software, but you are guaranteed performance benefits!  If your current WordPress host doesn’t support PHP 7.1 yet, we strongly encourage you to seek out new hosting. And likewise with themes and plugins. If the developer has yet to release a patch, it might be time to find an alternative.

Have you recently migrated to PHP 7? We would love to hear your thoughts below. Was it an easy transition? Or perhaps you are still stuck waiting on a 3rd party.

If you enjoyed this article, then you'll love Kinsta’s WordPress hosting platform. Turbocharge your website and get 24x7 support from our veteran WordPress team. Our Google Cloud powered infrastructure focuses on auto-scaling, performance, and security. Let us show you the Kinsta difference! Check out our plans

Hand-picked related articles

Comment policy: We love comments and appreciate the time that readers spend to share ideas and give feedback. However, all comments are manually moderated and those deemed to be spam or solely promotional will be deleted.
  1. Gravatar for this comment's author
    mhplaban March 16, 2017 at 8:59 pm

    PHP 7 is a HERO

  2. Gravatar for this comment's author
    Creativetacos | Free Resources March 20, 2017 at 6:18 am

    We are using PHP 7 and it is amazing :)

    1. Gravatar for this comment's author
      tomzur March 20, 2017 at 6:58 am

      Enjoy the performance boost :)

  3. Gravatar for this comment's author
    Scott Sutton March 23, 2017 at 7:48 am

    I have some websites running PHP 7, but there are still a lot of compatibility problems with themes and plugins. This idea of forcing PHP 7 down our throats doesn’t work for me.

    1. Gravatar for this comment's author
      Brian Jackson March 23, 2017 at 8:59 am

      Hey Scott! Ya, the idea isn’t to force it down your throats, but rather to remind people why they should be moving forward. In your case, it actually sounds like the developers of the themes and plugins should be updating. PHP 7 was officially released in Dec 2015, which should be plenty of time to update compatibility. I’m curious, which plugins/themes do you have issues with?

      1. Gravatar for this comment's author
        Scott Sutton March 23, 2017 at 9:13 am

        I still need to sort through the mess to determine which plugins are truly incompatible and which ones just show up as false positives using the PHP 7 Compatibility checker.

        Unfortunately, I have a custom theme with definitive compatibility issues. It was developed in January 2016 so I can’t necessarily fault the programmer for not being 100% PHP 7 compatible. The checker showed a bunch of deprecated code, and switching to PHP 7 as a test resulted in the dreaded “white screen of death”.

        1. Gravatar for this comment's author
          Evan May 2, 2017 at 11:45 am

          Any plugins or themes which are still not compatible with the current stable version of PHP are good candidates for plugins and themes to replace with ones that are (especially if you paid for them). PHP 7.0 was released in December of 2015 (almost 1.5 years ago now), there’s really no excuse for 3rd party plugins and themes. The speed increase is a nice byproduct of upgrading but the main reason should be to stay on a stable, actively-supported version of the software you are using. PHP 5.5 and below are dead, never to be updated again for any reason.

          The WSoD generally means you don’t have WP_DEBUG enabled to see the errors that are causing the fatal. Your upgrade may be as simple as working through the errors you see, one at a time.

          There really isn’t that much that should need to change to bring your theme or plugin up to date with PHP 7. Most upgrade errors I’ve seen are due to deprecated functions that were removed.

          At any rate, PHP 5.6 will still receive security updates until December 2018, so you have plenty of time to migrate yet.

  4. Gravatar for this comment's author
    Grégor April 12, 2018 at 11:58 am

    On my job we are still with php5.6 and making modifications for php7, it’s not complicated at all. We want to take advantage of php 7 performance

    1. Gravatar for this comment's author
      Brian Jackson April 12, 2018 at 12:52 pm

      Glad to hear it Grégor! The performance improvements alone with PHP 7.2 are amazing.

Leave a Reply

Use WordPress?

Use WordPress?

Join 20,000+ others who get our FREE weekly newsletter with WordPress tips on how to drive more traffic and revenue to your business!

Consent

You have Successfully Subscribed!

Send this to a friend