How to Update the PHP Version in WordPress-2022: A Step-By-Step Guide
Many WordPress users are on older versions of the software because they’re afraid of breaking things or they simply don’t know how to upgrade their WordPress site.
Upgrading your PHP version, however, isn’t difficult and only requires you to follow three easy steps: backing up your website and files, changing your PHP version settings, and updating WordPress itself.
This step-by-step guide will help you update the PHP version in WordPress 2022 with ease.
What is PHP?
PHP is a server-side scripting language that enables developers to create dynamic content that interacts with databases. WordPress is written in PHP, so understanding how to update your version of PHP is essential for keeping your site running smoothly.
The Need For an Upgraded PHP Version
In order for your website to function properly, you need to have a certain version of PHP installed. This is because different versions of WordPress require different versions of PHP. For example, as of April 2021, the latest version of WordPress is 5.7 and it requires PHP 7.4.
Installing Newer Versions of PHP
It’s always a good idea to keep your software up to date, and that includes the version of PHP that your WordPress site is running. Newer versions of PHP offer performance improvements and security enhancements over older versions.
Plus, many plugins and themes require a newer version of PHP in order to work properly. Here’s a step-by-step guide to updating the PHP version in WordPress.
Editing wp-config.php File
1. Locate your wp-config.php file. This file is located in the root directory of your WordPress site.
2. Edit the file using a text editor, such as Notepad++.
3. Find the line that says define(‘WP_DEBUG’, false); and change it to define(‘WP_DEBUG’, true);
Further Configuration of wp-config.php File
Check PHP Compatibility
Now that you have the latest version of plugins and themes, you need to test them using the PHP Compatibility Checker plugin. After activating the plugin, go to Tools >> PHP Compatibility. Next, select the latest version of PHP.
Check on the next page, you will see the PHP version your web server is using below. Lastly, click on Set as Current. You are all done! All is set without any stress and with no problem.
After updating the PHP version, you need to edit the wp-config.php file and set some additional directives. The first directive you need to set is the WP_MEMORY_LIMIT. This will tell WordPress how much memory it can use. You can set this to 64MB by adding this line to your wp-config.php file:
define( ‘WP_MEMORY_LIMIT’, ’64M’ );
What if my website is broken by the PHP update?
You can always restore the most recent backup you made if you encounter any problems while updating your PHP version. This is why we advised you to create a site backup right now for free on this website https://updraftplus.com/?afref=2240 .
It can be a conflict with your plugin or theme, though, if the upgrade is preventing your website from loading. It happens when your plugin’s routines that were developed in an earlier version of PHP.
You might need to investigate your plugins and theme to identify the issue’s root cause.
Deactivate every plugin and then see if your website returns. In that case, one of your plugins is at blame. Start turning on each plugin one at a time to discover the broken one. Verify that your website is operational every time.
The plugin you turned on soon before your website went down is probably to blame. Just deactivate the plugin and look for a different one.
If your website is still not loading at this stage, you might want to downgrade the PHP version used by your WordPress site. After that, get in touch with your hosting companies or employ a specialist to help you update the PHP version of your WordPress websites.
The technological landscape is ever-evolving. There is a fresh update for something every day. Due to their popularity as website resources, WordPress and PHP frequently receive upgrades that improve their performance.
Recommended reading: 5 Tips to Help You Plan and Write Better Content in 2022