If you are managing and maintaining your own WordPress website, you need to know what PHP is and when and how to update it. This will keep your website running with the best and latest code possible.
What is PHP?
Simply put, PHP is the software language that WordPress uses. It runs on your web server. That means your hosting company is responsible for providing you with the latest version of PHP but they are not responsible for updating it for you.
Fortunately, you don’t need to know any code but you do need to know how to update it (although some kind hosting companies will update it if you ask).
Why do you need to update PHP?
Software languages evolve all the time to add new features, fix bugs and strengthen security. Don’t be alarmed that software needs to be updated. It’s a fact of life. Imagine if you were still running a website using code that was developed 20 years ago? It would be very slow and outdated by now.
It’s always best to keep up with technology where possible to keep your website modern, with the least amounts of bugs and safe and secure.
Will updating to the latest version of PHP break my site?
As with any software update, it is possible that your website may break. This will happen if your theme or any plugins you are using are not compatible with the PHP version you have chosen. If you do break your site when updating, don’t worry, it is really quick to roll back your PHP version should your site not be compatible with the version you have chosen.
Your site may be down for less a minute so don’t worry too much.
Testing your website for PHP compatibility
Before testing for compatibility I recommend making sure your plugins and theme are up to date.
Before you update the PHP version your WordPress website is using, you can test it to see if the version you want to update to is compatible with your theme and plugins.
Download and activate the plugin ‘PHP Compatibility Checker’.
From the WordPress dashboard Go to Tools -> PHP Compatibility.
Select the PHP version you want to test (at the time of writing this 7.3 was the latest).
Click on ‘Scan Site’. It can take a while to scan so be patient.
While you are waiting, take a moment to read the limitations and caveats. Basically, this tool will do it’s best but it might not find every problem. It should give you some confidence to upgrade but you still might need to roll back to an earlier version if you encounter a problem.
When the scan has finished you will see a list of plugins and your theme with a note next to it to say whether or not it is compatible. If anything is incompatible you can always use an earlier PHP until you find the version with the most compatibility.
You can also ‘toggle details’ next to the item that has been scanned to find out more about what the scan found. You may find more error details. You will have to decide if you want to go ahead with the update or replace the plugin. You could always contact the plugin developer for further advice.
You may find the plugin or theme wasn’t scanned because the server settings didn’t allow it. In this case you might want to speak to the hosting company to ask their advice on upgrading your hosting package.
How to update your PHP version
If you are really worried about doing this then either ask your hosting company to do it for you or ask an experienced web developer (you can always contact me).
If you are confident then head over to the control panel in your hosting account. If you are not sure where this is, ask your hosting company. Different hosting companies can have different control panels and you may find they have their own instructions for updating the PHP version.
If you are using cPanel
If you have ‘cPanel’ then scroll down near the bottom of the panel. You will find a section called ‘Software’.
In this section you will see an icon saying ‘Select PHP version’.
Click on the icon to open up the PHP options.
In here you will be able to see your current PHP version. Make a note of this. If anything goes wrong you will want to reinstall this version.
Below the current PHP version you will see all the available PHP options (you may have to click on a drop down button to see them all).
Select the version you want and click on ‘Set as current’.
Check your website works as expected.
What to do if your website broke when you updated your PHP version
If you do find problems on your website, just go back into your cPanel and select the version of PHP you had previously. Meanwhile you might want to try and work out what is not compatible using the compatibility checker and looking for a replacement (it may a plugin or theme).
Did you try this? How did you get on? Let me know in the comments below.
SHARING IS CARING
If you have enjoyed this article and found value in it, please consider sharing it with someone who would benefit it. Not only will it help them but it will help me too. Thank you.