How to Update the PHP Version of the WordPress Website
From this tutorial, you will learn how to update the PHP version in WordPress and why it is important.
Tutorial requirements:
- Up and running WordPress website;
- Access to the admin panel of your hosting provider with full rights.
Updating the PHP version might sound intimidating and complex for the beginner in WordPress, but it’s a straightforward procedure that literally takes a few minutes. All you need is to follow a few simple steps.
Why Update PHP for the WordPress Website
WordPress runs on PHP, an open-source programming language maintained by a community of developers. This community supports each PHP version for two years from the date of its stable release, providing bugs and security fixes. Then, the version gets only critical updates and security patches for one more year. After that period, the PHP version became deprecated and no longer maintained.
There are three main reasons why PHP must be updated on time:
- Security. Simply put, the newer the version, the fewer hackers have examined its vulnerabilities. Also, as the community maintains PHP, the latest versions get their security issues reported and patched regularly.
- Speed and performance. The website’s speed affects not only the user experience of the visitors but also the search engines’ ranks. The latest PHP version always runs 10-15% faster than the previous. And the difference between version 8.0 and 5.6 is almost 400%.
- Stability. The latest versions have as many configuration errors fixed as possible, which means that the stability and performance of the website are much better than if it runs on older versions.
How to Check the PHP Version in WordPress?
You can check the current PHP version right in the WordPress dashboard:
- Click Tools > Site Health.
- Go to the Info tab.
- Open the Server accordion tab.
There you will find the information about your current PHP version.
In this tab, you will also find more details about your website’s PHP and server settings, including the PHP memory limit and the PHP time limit.
You can find the stable releases and the timing when they become obsolete on the official website of the PHP community. If your current version is about to reach the end-of-life (EOL) anytime soon, it is strongly recommended to update the PHP version.
What to Check Before the Updating?
Technically, WordPress works with PHP versions up to 5.6.20. If the website has plugins or any kind of code with functions no longer supported by newer versions, it will cause an error. To avoid such a situation, just follow the simple steps:
- Make a full backup of your website; it’s absolutely necessary before any important website updates, including PHP version changes. There are many backup plugins, but the best way to do it is via the admin panel of your hosting. There’s always such functionality available. In case of compatibility issues, you can easily roll back from that backup.
- Update the WordPress version to the latest. For doing this, go to the Dashboard > Updates section on the admin panel of your website. There you will see not only the current WordPress version and the latest updates available but also the plugins and themes that need the same.
- Update the WordPress version, all the plugins, and the theme.
- Go to the front end and check if everything works smoothly.
- Install the free PHP Compatibility Checker plugin and find out whether the website is ready for the PHP version update.
Update PHP with Kinsta Hosting
Updating the PHP version with Kinsta hosting is very easy, too. It has its own custom panel to manage everything in your account, and the PHP update will take just a few minutes.
1 Step — Create a staging environment for your website
Creating the staging website constructs a testing environment for your live project, duplicating everything you have on the live one. There, you can try all the updates, test all the plugins and themes, and ensure everything works smoothly. After doing that, you can push it to the live website.
- Go to Dashboard > Sites.
- Click on the website you want to work with.
- Choose “Staging” on the drop-down menu in front of the name of the website.
- Press “Create a staging environment.”
It might take a few minutes; after it’s been created, make sure you didn’t switch back to Live and work in a Staging environment.
2 Step — Update the PHP version
- Go to the Tools tab at the website’s dashboard menu.
- Find the PHP engine section.
- Click “Modify” and choose the PHP version you want to be updated to from the drop-down menu:
- After that, you will see the pop-up warning window. Press the “Modify PHP version” button. The process of updating may take up to a few minutes.
3 Step — Test your website in the staging environment
Test your plugins and theme and ensure everything works properly on the front end. The debugging mode can help see all the error messages. For this, go to Sites > Tools > WordPress Debugging and click “Enable.”
In case something is conflicting, and you see error messages or just a white screen, deactivate all the plugins and then reactivate them one by one, detecting which one may cause the error and has a compatibility issue with the new PHP version. In most cases, everything goes smoothly on this step if you don’t use very old plugins which are no longer being maintained and updated.
If you have experienced any compatibility problems and had to change something in your website structure or code, you will need to use the Push Live option not to repeat the same actions on fixing your code on the Live website. Do it when you make all the fixes and make sure everything works smoothly. The “Push Live” button can be found on the drop-down menu at the top of the website dashboard.
4 Step — Update the PHP version in the live environment
After you pushed the website live from the staging environment, or it wasn’t necessary because you didn’t experience any compatibility problems, switch to the Live environment and update the PHP version there (Sites > Tools > PHP engine > Modify).
The website users will not experience any downtime while the engine is updating and restarting.
Update PHP with SiteGround Hosting
SiteGround is another hosting offering managed WordPress service. It has a pretty fast and easy process of PHP version update.
The staging is unavailable on the Startup plan, so make sure you make a backup. They do daily backups automatically, but it’s much better to do it right before making such big changes. Go to Dashboard > Security > Backups and create it.
In the GrowBig and GoGeek pricing plans for the WordPress managed hosting, they have a staging feature, which is very handy for testing the website compatibility with the newest PHP version.
1 Step — Create a staging copy of the website
- Go to Dashboard > WordPress > Staging.
- Name your staging copy and press “Create.”
2 Step — Update the PHP version for the staging copy
- Go to Dashboard > Devs > PHP manager.
- Choose the Staging Sites tab.
- There you will see a current PHP version that runs your website:
- SiteGround updates PHP versions automatically by default. But you can do it manually, too. For that, press the pencil icon in front of the current PHP version, and choose a Manual Update option in the pop-up menu. Choose the PHP version you want to update to and confirm your choice:
3 Step —Test your staging copy
Make sure that everything runs smoothly on the front end of your website. If not, try to deactivate all the plugins and reactivate them one by one, detecting which might have a compatibility issue.
If there were issues and you have done some work to get rid of them on the staging website, after ensuring everything works properly, go to WordPress > Staging > Staging Copies. In the Actions column in front of the latest staging version of your website, press the vertical dots icon and choose “Full Deploy” options from the pop-up menu:
After that, the fixed version of the website will go live.
If there were no compatibility issues with the staging copy, skip this deployment step.
4 Step —Update the PHP version of the live website
- Go to Devs > PHP Manager > Live Sites tab.
- Repeat the same actions you have done for the staging site PHP update.
FAQ
Yes, it’s crucial because it protects the website from security vulnerabilities and makes it work faster.
You can find this information on the official PHP website on the supported versions page.
No, it’s a very fast and easy process. The only thing that can make it more difficult is if you have outdated plugins or a theme that is no longer being updated or unsupported by the new PHP version functions in your website’s code.
Now you know how to update the PHP version which runs your WordPress website. It’s an easy process unless you experience some compatibility issues, which doesn’t often happen if you maintain the website correctly.