PHP 8.0 was released nearly 2 years ago and the support for PHP 7 has come to an end. Over 60% of all websites built with PHP-based systems still use PHP 7. When you combine the fact that WordPress is built with PHP and WordPress powers 40% of all websites worldwide, this is particularly huge for the whole internet community.
PHP 7.4 is the latest version of PHP 7 and it has stopped receiving any security updates from November 28th, 2023. Staying on PHP 7.4 past that date introduces major security risks. In fact, staying on PHP 7 after its EOD could also reduce the website's stability as well as degraded performance.
If you have a Drupal website or a WordPress website and are already running PHP 8, congrats you are safe on this aspect. However, if you have not yet made your way up and are still using PHP 7, it is important to plan for the update as soon as possible. Whether it is doing it yourself or getting someone with the technical expertise to do so. If you ignore the issue for long enough, eventually it will escalate to fatal errors and will stop your website from working completely.
WordPress 6.1 release offers full compatibility with PHP 8. Although PHP 8.0 first came out two years ago, it only offered beta compatibility for PHP 8.0 and 8.1. This new release is the first stable release that is compatible with PHP 8.1.
However, depending on the plugins you are using, you might have a number of plugins that are yet to be compatible with PHP 8. This is definitely one of the major difficulties WordPress users will face with the upgrade.
Here are the steps you need to take to update your WordPress website to PHP 8.1
Create a backup
This is to prevent data loss or if anything unexpected happens, you have a copy of your website that can be restored at any time.
Create a staging environment
To fully test out any features or functionalities that you may have on your website, it is safer to create a different environment for your website. This way if anything goes wrong or if anything unexpected happens, your live website will not be affected.
Upgrade and test
On the staging or test environment that you copied out, update your plugins so they are compatible with the latest version of WordPress. Then update your website to WordPress 6.1 and PHP 8.1 from your hosting control panel. Once the update is completed, start to test all the different elements, features and functions of your website. If the entire website shows a fatal error, that means there potentially could be bigger problems that you need to address. If there are small issues such as some plugin functions not working properly, it could be because the plugin itself has not been updated yet, you might want to use another plugin that is compatible or wait for the plugin for a newer version. Please note that not all plugins will have stable releases that are compatible with PHP 8 and WordPress 6.1. Gather all the issues that you found.
Address found issues
Depending on the errors and issues you discovered, there might be a quick fix or it could require more digging, especially if you have custom plugins or complex custom functionalities.
Deploy to Live site
This step depends on your workflow. Some hosting solutions allow you to push the code up, some hosting solutions allow you to copy the site over. If you don’t have any of these workflow setups, you can always replicate the updates on the live site. That is if there were no issues in the staging environment at all.
If you are rocking a Drupal website like this website you are on right now, the steps of updating to PHP 8 are a little more complicated. Stay tuned to part 2 of this article for more details. In the meantime, if you have any questions or if you are looking to upgrade your website with some assistance, feel free to reach out to us and we are more than happy to take a look at your project.