If you want to keep your website running smooth and secure, it is a good idea to keep your PHP version as up to date as possible. There are many beneficial reasons why one would want to update the PHP version on their sites, such as staying up to date on the latest security and bug fixes and being able to keep up with the latest updates from your favorite themes and plugins.
Also, the lifetime of older PHP versions is running out. Active support for version 7.3 ended at the end of 2021. Security support will only be provided until the end of 2022. This means that versions of PHP 7.3 or higher should be used as they are the only versions currently receiving security updates. So if you plan on updating PHP it should be to a version 7.3 or greater.
Before You Update PHP...
While that does sound awesome it's not always smooth sailing when updating PHP. There are a few things to keep in mind before updating the PHP version on your site or server:
Not all themes and plugins may be up to date with the newest or latest versions of PHP. You will want to check the documentation for the plugins and themes you are using to make sure they will support the PHP version you are updating to. If you are unsure of whether a certain theme or plugin will work with newer versions of PHP please contact the author of the plugin or theme.
There are also plugins that will check the code on your site to see if they are compatible with later versions of PHP.
PHP Compatibility Checker This plugin will lint theme and plugin code inside your WordPress file system and give you back a report of compatibility issues for you to fix. Compatibility issues are categorized into errors and warnings and will list the file and line number of the offending code, as well as the info about why that line of code is incompatible with the chosen version of PHP.
Error Log Monitor This plugin will log PHP errors in your WordPress dashboard so you can view if you have any incoming incompatibility errors when using a more up to date PHP version. You will always want to watch your site's error logs after updating PHP that way you can see if it is causing any errors that were not on your site previously.
Note: These are third-party plugins and are not associated with iThemes in any way; install them on your site at your own risk.
Besides themes and plugins, if you have any other software on your server that is utilizing PHP code then it is a good idea to check the documentation or contact the author of the software to make sure the code is compatible with the PHP version you are updating to.
Before updating your PHP version it is always a great idea to BACKUP your website!!
Time to Update PHP!
As stated previously in the article, it is best to make sure your site is running on a version 7.3 or higher as any version before that is no longer receiving security updates. When attempting to figure out which PHP version to switch or update to, it is a good idea to check the WordPress requirements codex article here: https://wordpress.org/about/requirements/ This article lets you know the PHP version WordPress recommends that you use.
If you are on a shared hosting platform, more than likely, your host has a select few versions of PHP for you to choose from. Often, these can be switched from the cpanel or custom control panel that your host has provided. Just select version 7.3 or higher and save the setting. If there is no way to change this from your host's control panel, please contact them directly and ask them to update your PHP to a version 7.3+ or higher.
If they refuse to update your PHP to a version 7.3+ or move your site to a server that has a more updated PHP version, it is time to switch hosts.