How to Update to PHP 8.0 and Why You Should
Notices are going out to all website owners who are not currently on the latest version of PHP: Hypertext Preprocessor (PHP). This is because PHP 7.4 has reached the EOL or “end of life,” and hosts will no longer support those older versions.
EOL occurs when a manufacturer stops selling, supporting, and patching their hardware or software. Functionally, the manufacturer no longer considers the software or device “useful” and likely plans to release a newer model.
Whenever an EOL event comes due, those who have ignored the years of warnings and nudges to update come out of the woodwork. Because we didn’t address these issues at the early stages, we ended up having a more complex and complicated update process due to also having outdated unsupported themes and plugins added to the mix.
Is Your PHP EOL?
You may have received an email from your webhost or have seen a “nag” notice in your WordPress dashboard:
PHP 8 is the latest version of the popular server-side scripting language used for web development. It was released in November 2020 and included several improvements and new features compared to its predecessor, PHP 7.X.
Why Update Your Server’s PHP Version?
One of the main reasons why PHP 7.X is no longer supported is that it has reached the end of its life cycle. PHP 7.0, for example, was released in December 2015 and received regular updates until December 2018.
After that, it only received security fixes until December 2019. Similarly, PHP 7.1 received regular updates until December 2019 and only security fixes until December 2020. As a result, it is essential to upgrade to PHP 8 to ensure that your WordPress website is secure and up-to-date.
To upgrade your website to PHP 8, you should follow these steps:
- First, check your current PHP version: Before upgrading, check the current version of PHP running on your website. You can check your web host’s control panel. Managed WordPress hosts will note this detail for you. If that’s not the case, you can create a PHP file with the following code:
<?php phpinfo(); ?>
Save this file in the root directory of your website. You can accomplish this through your hosting control panel File Manager or FTP and then access it via a web browser (yourdomainname.com/phpfilename.php). The page that loads will show you the current PHP version.
- Check compatibility: Ensure your website’s code is compatible with PHP 8. This requires you to check with your theme developer and that all installed plugins are supported and compatible. Some functions and features have been deprecated or removed in PHP 8, which could cause your website to break. The best way to test this upgrade is to do so on a staging website.
- Backup your website: Before making any changes, it is essential to back up your website files and database. This ensures you can restore your website to its previous state if anything goes wrong during the upgrade process.
- Upgrade PHP: Once you have confirmed compatibility on the staging website and backed up your website, you can upgrade PHP to version 8. This can be done via your hosting dashboard, where you can upgrade PHP yourself by following the instructions provided by your hosting provider. Or you can ask your hosting provider to upgrade the PHP version for you.
- Test your website: After upgrading PHP, test your website thoroughly to ensure that everything is working as expected. Check all functionality, including forms, databases, and third-party integrations.
- Fix any issues: If you encounter any issues during testing, fix them immediately. This may involve updating your website’s code to be compatible with PHP 8 or installing any required plugin or theme updates.
- Monitor performance: Once your website is running on PHP 8, monitor its performance to ensure that it is running smoothly. Monitor server resources, page load times, and error logs.
Why You Have to Update
The good news is this has been in the works for years. Theme and plugin developers have been moving forward to ensure compatibility. As a result, the only websites that may encounter severe issues are those websites that have not kept up and have themes that are many years old and plugins that are no longer supported.
In summary, upgrading to PHP 8 is important for security and performance reasons. However, before upgrading, check compatibility, back up your website, and follow the steps outlined above to ensure a smooth transition to the new version of PHP.