Wydajność i bezpieczeństwo

PHP 7.4 end of life: how to prepare your WordPress site for the upgrade

· Krzysztof Balicki

A server room aisle with racks in blue light

PHP 7.4 end of life is simple: after 28 November 2022 this version will not get a single security fix. Not one. So your site has to move to PHP 8.0 or newer, and you should rehearse the switch on a test copy first. You can find the date in the official PHP version support schedule. I am writing this for owners and admins of WooCommerce stores or company websites who still have a few months left. That is plenty of time to do it calmly, without nervous clicking in the last week.

What does PHP 7.4 end of life mean for your site?

Your site will not switch off. But any vulnerability found after that date will stay open in PHP 7.4 forever. First comes active support, which means bug and security fixes. Then comes security support, when only patches for critical holes are released. After that, nothing is released at all.

What does this mean in practice? Your store’s customer data is more and more exposed. Hosting providers sooner or later switch off old versions, and plugin authors stop testing their code on 7.4. On top of that there is GDPR, which requires appropriate protection of personal data. Unpatched software is hard to call appropriate protection (and you are unlikely to convince any inspector otherwise).

How to check which PHP version WordPress runs on?

The fastest way is in the dashboard: Tools > Site Health > Info > Server. The PHP version is right there, next to the memory and execution time limits. The second way is your hosting panel. The third, for the more technical: you upload a file with the phpinfo() function for a moment, read the output and delete it straight away, because it shows the whole server configuration. Oh, and the hosting panel is usually where you change the PHP version too, often separately for each domain and sometimes even for a single directory.

PHP 8 plugin compatibility: take stock before the upgrade

WordPress core itself rarely causes problems. Plugins and themes are what break. So before you switch anything, write down what actually runs on your site:

  • a list of active plugins and the theme, with their versions,
  • the date of the last update for each of them,
  • the tested PHP version listed on the plugin page or in the changelog,
  • plugins abandoned by their authors, to be replaced,
  • custom code: child theme, snippets in functions.php, add-ons written to order.

PHP 8 removed or changed some functions, and it checks types much more strictly. And here is the catch. Code that only threw a warning in the log on 7.4 can now take your site down with a fatal error. A white screen, and that’s it. You will get fixes fastest for plugins with an active licence and author support. At K4.pl the licence includes updates and support, and if your code is unusual, you can order a plugin built for your specific store.

Updating PHP in WordPress step by step

The order is always the same: backup, staging, tests, and production only at the very end. Staging is a separate, non-public copy of your site. You can break it as much as you like and no customer will ever see it.

  1. Make a full backup of files and the database.
  2. Update WordPress, plugins and the theme while still on the current PHP.
  3. Set up a test copy (staging) with PHP 8.0.
  4. Turn on WP_DEBUG_LOG in wp-config.php and go through the error log.
  5. Walk through the key paths: forms, login, checkout.
  6. Switch the version on production outside peak hours.
  7. Watch the server and WordPress logs for a few days.

What to test in a WooCommerce store after moving to PHP 8.0?

Everything that makes money. Cart, payments, shipping, customer emails. Place a few test orders through each payment gateway, check courier integrations, invoicing and sync with wholesalers or marketplaces. Then the admin panel: the order list, exports, cron jobs. Do not skip those last ones, because background errors like to show up only after a few hours, when everyone thinks the job is done. And PrestaShop? Same logic, but first find out which store and module versions support PHP 8 at all.

PHP 8.0 or 8.1: which version to choose in 2022?

The newest one that all your plugins, your theme and your hosting support. That’s it. Both releases have longer support than 7.4, and the exact dates are in the same schedule on the PHP project site. If one important plugin only works on 8.0, stay on 8.0 and come back to it when the author updates it. In my view, changing PHP is best treated as a recurring task, for example with a review once a year. Not as a one-off project done at the last minute.

By the PHP 7.4 end of life date you should have your tests behind you, not just be starting them. The first step is trivial: backup and staging this quarter.

Frequently asked questions

Will my PHP 7.4 site stop working after 28 November 2022?

No, it will work just as before. Only without security patches, so every newly discovered vulnerability will stay open for good. And over time your hosting may force a version change anyway.

Is WordPress itself ready for PHP 8.0?

WordPress core is regularly adapted to new PHP versions. But whether your site is ready depends on your plugins, theme and custom code. Those are exactly what you need to test on a test copy.

What to do with a plugin that does not work on PHP 8?

First update it to the latest version. Didn’t help? Write to the author and paste the error from the log. And if the plugin is abandoned, look for a replacement or order a fix or a new custom plugin.