Dropping Support for PHP 5.2
It all started with a tweet from Danny van Kooten (below). Then came this article from Iain Poulson where he elaborated a bit more on (not) supporting legacy PHP versions. And like many other plugin developers, we have been longing to implement modern PHP features in our plugins.
STOP SUPPORTING PHP 5.2 IN YOUR NEW PROJECTS.
No one using it is actively installing plugins, trust me.
— Danny van Kooten (@dvkoot) February 27, 2018
Until now we always kept Admin Columns on par with the minimum WordPress requirements to make our plugin as widely available as possible. We felt this was in line with the WordPress philosophy. But when we found out that the percentage of users with PHP 5.2 (who also keep WordPress up to date) was well below 1% we came to realize something: We have to start closing the gap between modern PHP versions and the minimum WordPress requirements. It maintains a technical debt with WordPress and the people who develop with it. And it will only grow if with every new version of PHP not being met by an upgrade of the WordPress minimum requirements. Even if our share in this will be very small, every step forward helps.
PHP 5.3 as Minimum Version for Admin Columns
Our first step in this will be the bumping the minimum version of PHP required to run Admin Columns. Therefore, the next version of Admin Columns (Pro) will have PHP 5.3 as it’s minimum required version. We are happy to announce to start implementing namespaces, closures, and late static binding right away. We’ll also be keeping a close look at the statistics of WordPress installations to find out when it’s a good time to move to PHP 5.4, which comes with some nice syntactic sugar as well.
By using the minimum required PHP feature from the WordPress plugin directory, we can notify our users in advance of this new requirement. Also, when you try to activate Admin Columns on a server that runs < PHP 5.3, it will display a notice telling you about this problem. By doing so we will not only notify people they should probably upgrade but also prevent any errors in the WordPress admin from calling undefined functionality.
Upgrading to PHP 7.2
If you are running a legacy version of PHP you should probably upgrade to PHP 7.2 (the latest stable version at the time of writing). It’s a lot faster than PHP 5.2 while also being more secure. Like WordPress, PHP is largely backward compatible. Therefore you probably won’t experience any negative effects from upgrading. However, there are a few things that did change and if you want to be sure your WordPress installation is compatible here a few things you can try:
- Run your website locally using something like Local
- Use this plugin to spot potential issues
- Ask your hosting company if you can test your website in a staging/testing environment that supports PHP 7.2
- Ask your hosting company if you can switch back to your current PHP version in case you encounter some issues
If you are still looking for hosting or want to know if your current hosting company supports PHP 7.2 you can use the example letter listed on the WordPress requirements page as a starting point:
I’m interested in running the open-source WordPress <https://wordpress.org/> web software and I was wondering if my account supported the following:
- PHP 7.2 or greater
- MySQL 5.6 or greater OR MariaDB 10.0 or greater
- Nginx or Apache with mod_rewrite module
- HTTPS support
And lastly, if you are unsure which version of PHP you are running at the moment, easily check this with the Display PHP Version plugin from the WordPress repository.
Looking at all the attention the PHP version discussion is getting lately, we might see some good things coming from the WordPress community to support modern PHP versions more actively. And once the popular plugins will drop the support for legacy versions (e.g. WooCommerce, Yoast, ACF) we could very well see a lot of hosting companies upgrade their PHP versions and we can all live happily ever after.