The following is a guest post by Chris Van Patten, founder of Tomodomo, a digital agency for magazine publishers.
For years, WordPress has been ever-so-slightly behind the times on PHP version support…to put it kindly.
However, WordPress’ legendary support for PHP versions back to 5.2 — versions long unsupported by the PHP project itself — wasn’t born out of a “we hate developers” strategy (although you’d be forgiven for thinking so given the reaction that policy often gets from developers). Instead, it was a genuinely noble and pragmatic effort to make WordPress, and thus publishing on the web, as widely available as possible.
Despite the reaction from many developers (and security-minded sysadmins), that strategy worked: WordPress powers over 30% of the web, and a significant chunk of those installations are on unsupported PHP versions. For those users, it’s not that they don’t care that they are on an unsupported version of PHP; they just don’t know, or don’t know how to solve the problem.
But the winds of progress are blowing, and in 2019 WordPress is planning to make a change. Assuming everything goes according to plan, PHP 5.6 will become the minimum supported version in the first half of the year, and the minimum version will be bumped again to PHP 7 in the second half of 2019.
There are obvious benefits here from a security perspective. The oldest versions of PHP supported by WordPress today stopped receiving official security updates ages ago (PHP 5.2 hit EOL, or “end-of-life,” nearly 8 years ago). The speed improvements will be tremendous as well, particularly in PHP 7. Speaking from my own experience, I have several sites that once needed aggressive caching to prevent server overload. Since PHP 7, they run faster than ever, without caching of any kind.
Speed and security are the two most-cited reasons (and the most measurable reasons) for bumping the minimum version, but there are also other less tangible benefits that will filter well beyond WordPress core development.
While plugin developers have never been obligated to support all the versions of PHP that WordPress core does, many still chose to do so. That’s understandable: it could be tough to explain to a user why they can install WordPress in a certain development environment but couldn’t install a certain plugin.
For plugins that tried to match core’s backward compatibility support, that means testing and supporting up to nine versions of PHP: 5.2 through 5.6, and 7.0 through 7.3. (There was no PHP 6. I won’t bother explaining the boring reasons why.)
By pushing to 5.6, and eventually some version of PHP 7+, that cuts the number of versions that developers will feel compelled to support in half. In some way, Core will likely continue to support these old versions (through security backports to old versions of WordPress, for instance) but plugin developers can be assured that they don’t need to — and don’t need to feel any semblance of guilt about it either.
Bumping the minimum version won’t change that apathy or exodus overnight, but it will give developers something to feel excited about. Modern PHP versions (especially PHP 7) offer genuinely cool new language features that make it easy to write performant, well-designed, and interesting code. I would even argue that it makes it fun. Modern PHP contains plenty of syntactic sugar, and while you shouldn’t base your diet on sugar it certainly makes for a nice treat.
Again, it is unlikely that core will start adopting these new language features on day one. The real benefit is that developers will feel empowered and secure in their decisions to start using these new capabilities, and will start to build plugins and themes that can borrow ideas from best practices in the broader PHP community.
Celebrating the intangible
While the measurable justifications for changing the minimum PHP version are certainly compelling, I think it’s also important to acknowledge these intangibles and indeed celebrate them. Bumping these versions will create a ripple effect across the ecosystem that will make developers more comfortable with writing modern code. It will reduce support and QA loads for companies that no longer need to support 9 different versions of PHP. It will make WordPress core a more attractive place to contribute.
Gutenberg, and all the modern tooling and architecture it brought, has already reinvigorated developers across the ecosystem and brought a huge number of new core contributors (myself among them). Embracing modern PHP is another step forward, and with other changes on the horizon (such as a move from SVN to Git, coding standards changes, and projects like Tide which embrace new languages and architectures) I hope that 2019 will be the year WordPress delivers not only a best-in-class user experience, but a best-in-class developer experience too.
A look at the statistics are fascinating (not only PHP versions). PHP 7.3 is almost a blip (it does not show in the chart), but will likely pick up speed. 40% are already on 7.0 or greater. A full 24.6% currently are running PHP versions lower than 5.6, something that will take a LONG time to change.
About 20% are running very old WordPress versions.
Looking at RTL locales, it is interesting to me that 0.8% are Farsi, while Arabic is only 0.3% (surprisingly matching Hebrew that I expected to be much lower than Arabic based on population).