Making my WordPress plugins require PHP 5.4

I think it’s time to start requiring PHP 5.4 in WordPress plugins. Even though WordPress still requires only PHP 5.2, I think it’s silly to keep telling people to run their websites on software that is no longer maintained for over four years now.

With plugins though, we can make up these requirements by ourselves, we don’t need to stick to the version that WordPress requires. In fact, I believe it’s going to make it easier for WordPress to move to PHP 5.4 and up as soon as more plugins already paved the road.

Let’s make my new plugins require PHP 5.4 already

So after I proposed the idea of shipping my new plugins with the minimum required version of PHP 5.4, lots of people agreed with me or liked the idea. Some even said they already skip at least PHP 5.2 support; Danny van Kooten for example, with the popular MailChimp for WordPress plugin. He’s going to no longer support PHP 5.2 in future versions, but also in new plugins as well.

A closer look at PHP 5.2 and PHP 5.3

This is not even about new features or anything in newer versions of PHP, but that definitely helps. The most important reason why I want to make this move, is that PHP 5.2 is unsupported for almost 4 years and PHP 5.3 is unsupported for 4 months already. This means that both versions have not received security fixes for a long, long time. In my book, that’s unacceptable.

Some Linux distributions say that they backport security fixes into unsupported PHP branches, but this doesn’t happen all the time in practice. With no security fixes, potential security issues in the software are plenty. So why do we still tell people it’s okay to run their websites on these really old PHP versions?

WordPress and PHP 5.2

So why does WordPress still support these old versions you ask? Well, the answer to that is twofold. First of all, because the statistics indicate that around 70% of all live WordPress installs is powered by either PHP 5.2 or 5.3. Second, because they fear that hosting companies will be reluctant to upgrade their hosting platforms.

What I really wonder is, how many of those 70% of online websites are actually still maintained? They might be running on WordPress 3.0 or even older for all we know. The data that is more relevant to answering this question, is not available. I would for example like to see what percentage of new WordPress installs is done on PHP 5.3 or lower. Based on that data you can make the right decision to bump the minimum required PHP version for future versions of WordPress.

Hosting markets are driven by demand

When it comes to hosting companies, I believe markets like hosting are driven by demand; they support what big projects require. There is a great blog post by Anthony Ferrara, with this quote:

“If major projects like WordPress and CodeIgniter say that “5.2 will no longer be supported”, the vast majority of hosts would almost immediately support newer versions. Why? Because if they don’t, they’ll lose business.”

He then goes on by saying that end users don’t need to know what PHP is. They just need to know if a host is compatible. He supports this claim by comparing it to the GoPHP5 group, in early 2008.

Lots of open source projects pledged to make their next major version require PHP 5.2, while PHP 4 was still the most used version. This lead to 100 projects, but also 100 hosting companies joining and within 6 months, 50% of all hosts adopted PHP 5.2. This was a huge step, even bigger than the step we need to take to move away from PHP 5.2 and 5.3.

Library to check for PHP 5.4

I’ll be making a library to bundle with all my new plugins, that tells people who are not on PHP 5.4 yet, what they can do to get upgraded or how to find a new host. Unfortunately, this will stop some users on shared hosting plans from using my new plugins. I hope the number of people struggling with this will not be that bad, but my library should also be a part of educating those users.

It will not be easy, but as soon as more customers ask their hosting company for a more recent version of PHP, they simply can’t refuse. It’s the market driven by demand again. We can make this happen if we act now.

The library will be made available on GitHub, possibly also on Packagist, so you are free to use it in your plugins as well. The more people who are willing to take this decision, the bigger the impact will be.

The future

WordPress is not going to bump the required PHP version soon, I think. I want to move forward though, help raise awareness with the end users and educate them. So I’m going to start shipping new WordPress plugins with my PHP 5.4 library in it and we’ll see how this goes. I don’t think there will be many people struggling to get upgraded to more recent PHP versions, if they aren’t already.

Like I said before, I will only do this to new plugins as I don’t want to affect existing websites. This will only potentially hurt the people that want to use a new plugin that bundles this library.

I think this will help WordPress push forward and help us adopt more recent versions of PHP in a much quicker fashion than we did before. We can’t keep telling people it’s okay to run software that is as old as these PHP versions are. It’s going to take time though and I have no illusions that my library will make a big impact. We’re going to take baby steps, one hosting company at a time.