Dropping support for outdated versions of PHP

Over the last year, I’ve been writing more and more PHP code that’s not compatible with PHP 5.2 (the lowest supported version of WordPress). A few of my plugins already require PHP 5.3+, and at least one currently requires PHP 5.6+.

As a developer, it becomes difficult to write code for old versions of stuff. Sometimes, that’s just part of the job. Supporting a few older versions of things comes with the territory.

However, when you’re writing code for a version of a language that hasn’t received an official security or maintenance update in over 7 years, it becomes a problem.

I want to build cool stuff. I don’t want to attempt to do it with outdated code.

The official stance on PHP versions

From this moment forward, Theme Hybrid strongly recommends PHP version 7.2+ and officially supports PHP version 7.0+.

Unofficially, I will continue to write code that should work with PHP 5.6+. However, I will not actively test this code against versions older than 7.0. I will certainly correct any reported issues on PHP 5.6 as well.

Why the change?

Honestly, there are features in more recent versions of PHP that make my life immensely better. Things like proper namespacing, anonymous functions, short array syntax, importing functions, and a number of other new features make day-to-day coding far easier. Sure, I could write the more verbose and more complex code to handle things down to PHP 5.2, but it’s mostly a pain.

There are a few PHP 7+ features that would be nice to have. However, I can mostly live without those for now. However, PHP 5.6 is the oldest version of PHP that still receives security updates. Therefore, I’ll continue writing code that works on that version. That’s a good compromise between using the latest and greatest while still supporting some older setups.

How to find your PHP version

If you’re unsure of which PHP version you’re running, grab a copy of the Display PHP Version plugin. It will display your PHP version on the Dashboard screen of your WordPress admin.

What if I’m on an older version of PHP?

Now is the time to talk to your Web host.

Often, Web hosts allow you to upgrade to newer versions of PHP via your control panel. So, check there first. If you don’t have that option or can’t find it, send off a support letter to your Web host.

I highly recommend requesting PHP 7.2 support, which was released in November 2017.

If your Web host is unable or unwilling to upgrade your PHP version to at least PHP 7.0, I’d suggest looking elsewhere for someone who’s a bit more deserving of your money. Considering that PHP 7.0 was released back in December 2015, it means that they’re not doing the job that you’re paying them to do. You deserve better service than that.

Also, it’s in both you and your Web host’s best interest to go with 7.0+, which is far faster. Seriously, if you’ve never upgraded a site with WordPress installed from 5.x.x to 7.0+, you’ll be pleasantly surprised when you do.

Stay on top of PHP versions

If you’d like to stay on top of which PHP versions are currently supported, check out the Supported PHP Versions page.

2 Comments


  1. ·Reply

    Great move! Writing code for PHP 5.2 is a pain.

  2. Steven
    ·Reply

    Thank you for this decision! Hopefully it will also help WordPress to ditch the support for <5.6 PHP versions faster as well when more theme/plugin authors follow you example.

    Ideally – WordPress would push actively for the outphasing of older – no longer maintained – PHP versions so they can optimize their own code too and move on to, for example, a better hashing algorithm like bcrypt for the passwords (see https://core.trac.wordpress.org/ticket/21022).

Leave a Reply

Your email address will not be published. Required fields are marked *