PHP is a scripting language used to create responsive and interactive websites. WordPress is developed using PHP. PHP Developers fix vulnerabilities and provide several improvements with every PHP update. Staying updated with the latest version of PHP secures your website from cyber-attacks and gives an immense boost in performance.
You should update PHP on WordPress if,
- Your site is slow
- Your site undergoes a lot of online attacks
- For improved performance and security
Using this guide, you will update PHP on WordPress to the latest version and make your site faster and secure.
1. Improved security – Average PHP vulnerability fixes per year are 30, which are great opportunities for infiltrators to exploit your website if left unfixed.
2. Improved performance – Every PHP update gives a boost in performance. Some updates provide massive improvements than the others.
For example, PHP 7 operates at half the latency of PHP 5.6. That’s 50% improved performance and the number of requests made/ second is double that of PHP 5.6.
3. Better support – Older PHP versions cannot be supported by developers for a prolonged period and have a higher chance of being abandoned.
If a core functionality of your website runs on an older version of PHP, in addition to less security and slow performance, it is hard to find support if your site runs into an issue. It’s impossible to fix your site without any support.
You get support with newer PHP versions, and your site becomes compatible with a vast array of plugins.
1. Update Plugins and Themes
It’s a good practice to update your WordPress core, themes and plugins which helps to stay on top in terms of security and performance.
Note: If you’ve made any changes to your live theme’s code, create a child theme and replicate those changes. This will avoid loosing the data during the update.
2. Backup your website
Updating your PHP version could break your site if something goes wrong. As a safety measure, it’s better to backup your entire site. I recommend Updraft Plus for easy site backups.
3. Check your current PHP version
Knowing what version of PHP you’re running on will serve as a guide for updating it.
To find the current PHP version:
I. Log on to your WordPress dashboard
II. In the Tools tab, click “Site health”.
III. Click Info
IV. Click Server. You can find your PHP version here.
4. Check PHP compatibility
You’re going to check if all your plugins and themes support the latest version of PHP using a plugin called PHP Compatibility checker.
1. Download PHP compatibility checker and activate it.
2. In your installed plugin dashboard, find this plugin and click “Start Scan”.
3. Click on the latest PHP version. Choose a “Plugin/ Theme Status” depending on your requirements. Click “Scan site” to perform a scan.
The scan time may vary depending upon the number of plugins and themes you use.
4. Once the scan is complete, each plugin is denoted with three possible results.
i. Compatible – The plugin fits with the desired PHP version
ii. Error – The plugin is not compatible, and you’ve to start looking for an alternative plugin or contact the developer to find if the plugin will support your desired PHP version soon.
iii. Unknown – This isn’t an error. As the size of the plugin was too large, it is skipped. Google or contact the developer to find if the plugin supports your desired PHP version. If not look for other plugins with similar functionalities and higher PHP support.
Unless you’re clear that all your plugins and themes support the latest PHP version, DO NOT proceed further. Updating your PHP without following the above requirements will more likely break plugin functionality or the entire site.
Shared Hosting – Using CPanel to Update Your PHP
Updating PHP varies amongst different hosting providers. Here’s a generalized procedure on how to update your PHP.
1. Login to your CPanel dashboard.
2. In the search bar type in “PHP”. Click on the result that matches with “Select PHP version”.
3. Choose your desired PHP version under “Current PHP version” and click “Set as current”. Your PHP version is updated.
4. Now, php is updated to latest version. To ensure there are no errors, Navigate through your website to spot errors and missing functionalities. In most cases, there would be none. If such an error exists, find the plugin that causes it and replace it with one that offers a higher PHP support.
Dedicated Hosting – Using Web Host Manager
1. Log in to your WHM(Web Host Manager) dashboard as the root user.
2. In the search bar type in “easy” and click on the “easy-apache”.
3. Click the “customize”.
4. Click on “PHP versions”.
5. Click the slider to install your desired PHP version. In this case, it’s PHP 7.2.
6. Finally click review (from the left sidebar) to update. The process may take a few minutes to complete. You’ll now be displayed with a list of changes you’re about to make. Click the Provision button to proceed. Wait for a few minutes.
7. A message stating Provision process is complete is displayed. This marks the end of the PHP update. Click Done to finish the process.
Getting Help From Your Hosting Provider
If the above guide doesn’t support your hosting provider, you can find hosting specific tutorials on how to update your PHP in WordPress.
Alternatively, you can send an email with this context to your hosting provider to update php on WordPress.
To summarize, you’ve updated your PHP version in WordPress.
You’ve also improved your WordPress speed and security by updating the PHP version of your website.
Feel free to comment if you’ve any questions.
1. How to update PHP on WordPress Bluehost?
To update your PHP in BlueHost, read this Bluehost specific tutorial. Check out this page to find domain-specific instructions for updating your PHP in WordPress.
2. How to downgrade the PHP version in WordPress?
Repeat the process of updating your PHP, but choose a lower PHP version instead of choosing the higher one that your WordPress site supports. It is not recommended unless it’s necessary.
3. Some of my plugins don’t support the latest PHP version. Should I replace them before updating or vice versa?
I recommend replacing them with plugins that support higher PHP versions, or you can contact the developer to check if they could offer support for the latest PHP version soon. DO NOT update your PHP until all your plugins are compatible.
4. What is the latest version of PHP for WordPress?
Though PHP 7.2 and 7.3 are supported, WordPress.org recommends PHP 7.4 which is the latest version of PHP for WordPress.
5. How long does it take to update PHP on WordPress?
Updating your PHP in WordPress takes less than 5 minutes and you won’t experience any downtime.
6. How can I check my PHP version?
You can check your PHP WordPress in WordPress -> Tools -> Site Health -> Info -> Server. You’ll see the version of the PHP which your site is using.
7. Should I update PHP?
Yes, Its recommended to update PHP to latest version always to avoid any security and stability issues.