The majority of active WordPress installations still use PHP 7.4 (56.9%). PHP 7.4 is no longer maintained beginning November 2021, and has only been on minimal security maintenance support until 28 November 2022. By that date, PHP 7.4 will be officially declared end of life.
This means that all WordPress sites which would like to be on a security-supported PHP version should be on PHP 8 or later by then.
Why does this matter?
PHP is used by 77.4% of all websites. Given that WordPress runs on PHP and accounts for 43% of all websites, this isn’t surprising.
PHP is the lifeblood of the WordPress application. PHP runs all of WordPress’ theme, backend and data storage behaviour. You will want to get that to the latest supported version to have your site continue supporting the growth of your business goals.
Moreover, hosting providers can decide not to support outdated versions of PHP – leaving you helpless should something catastrophic happen.
Do I get benefits?
Upgrading has its benefits of course!
Better performance – Based on some benchmarks across different platforms, there’s an observed performance improvement from 2.6% to nearly 12%.
Better options – PHP 8 brings in tons of new improvements and features that allow developers to build better applications.
More details about the changes and improvements can be found on the official PHP website for PHP 8.0 and PHP 8.1.
Doing it consistently
Obviously, you don’t want to be playing catch up or running tight into the deadline of upgrading to the next major PHP version. This was the case with many enterprise websites back when PHP 5.6 reached EOL at the end of 2018.
Getting prepared for future updates at a comfortable pace can be achieved by:
- Using automated tools such as PHP_CodeSniffer to check code compatibility with PHP 8.x. This can be used by your developer team to check if their code is compatible.
- Implementing a CI/CD (Continuous Integration & Continuous Deployment) system where it tests your code base against different PHP versions. This way your developers can catch any incompatible code earlier, before it is released to production.
- Ensuring your local development platform allows you the option to develop on different PHP versions.
When developers work on understanding changes in the next major PHP version and start taking notes on their current implementation, making sure to avoid using functionalities that are about to be deprecated, the cost and time towards making the switch can be significantly reduced.
As an additional step, developers can also use PHP Polyfill to use future functions in their current PHP version. This means the developer can even prepare to use PHP 8.1 functions while running on an earlier version.
What to do now
If you’re still running any PHP version older than 8.x, you need to talk to your engineering team or development agency as soon as possible.
PHP 8.x is a major version upgrade from PHP 7.4, and unfortunately it has less backwards compatibility and does deprecate a few functions.
The big challenge for this upgrade is legacy code, tech debt and third party plugins that you may be using. If you have a relatively large codebase and a site with many features, you need time and expertise to do this upgrade.
Human Made Senior Engineer Ivan Kristianto has the following tips for your team or trusted agency:
- Prepare test case scenarios for all your features, especially business critical features. It would be much better if you already have unit tests or integration tests in place.
- Audit & evaluate the entire code base, including the 3rd party plugins you are using.
- If your codebase is incompatible, update/patch/rewrite it
- If the code comes from a 3rd party, ask the author/vendor if they have upgrades
- Prepare your test environments
- Do test your updates against your test case scenarios. And if you have unit tests or integration tests, this can be automated.
- Backup everything!
- Prepare a launch plan when switching to PHP 8.x – some hosting may need some time to prepare this upgrade.
- If your server stack is on premise or bare metal server, you may need to set up a redundancy server, so the switching only happens on DNS or load balancer.
- On container based infrastructure such as Altis Cloud, switching to PHP 8.x can be done in less time.
If you’re just getting started on this journey, feel free to drop us a line to get some help. And while you’re at it, go all the way to PHP 8.1!