How to Update PHP in WordPress
Do you want a faster, more secure WordPress website?
It’s important to keep your themes, plugins and even your WordPress software up to date, but what about PHP? WordPress runs on PHP, so upgrading to the latest version is just as important as keeping your plugins, themes and WordPress itself up to date.
By switching to the latest version of PHP, you can improve your website’s performance, security and Search Engine Optimisation (SEO), while also providing a better user experience.
In this quick tip, we’ll look at why PHP is so important for WordPress, and the steps you can take to ensure a smooth migration to the latest and greatest version.
If you want to make it easy to install and manage your WordPress site, take a look at SiteGround. It comes with an easy installer, free support, and automatic updates including the PHP version. We’re happy to be able to offer a huge discount of 70% off self-managed WordPress hosting, thanks to our partnership with SiteGround.
Why Do I Need to Update My Website’s PHP?
Behind-the-scenes, WordPress uses PHP as its scripting language.
The WordPress platform supports various versions of PHP that you, or your hosting provider can install on your website’s server, but there are two major reasons why you should always choose the latest version of PHP:
A High-Performing Website
Updating to a new version of PHP can make your website run up to 4x faster. A faster website provides a better user experience, so visitors will be more likely to stick around for longer and perform positive actions, such as signing up for your mailing list, or commenting on your latest blog post. Google also takes page loading times into consideration when ranking your website, so a PHP upgrade has the potential to boost your SEO and drive more people to your site.
The Latest Security Features and Fixes
Hackers are discovering new exploits all the time, so it’s essential that you keep your software up to date, and PHP is no exception. New versions of PHP often introduce patches, bug fixes and security features that can help protect your website against viruses, malware, hackers and many other digital threats.
Before You Upgrade
While you’re unlikely to encounter any major issues when installing a new version of PHP, why take the risk? To ensure a stress-free migration, you should:
1. Backup Your WordPress Website
In the unlikely event that something goes wrong, creating a backup ensures that you have something to revert to.
2. Update All of Your Themes and Plugins
If you’re using third party WordPress themes and plugins, then there’s no guarantee they’ll be compatible with every version of PHP.
After upgrading, there’s a chance that some of your add-ons may suddenly stop working. If you’re using a popular theme or plugin that’s regularly updated, then it’s unlikely you’ll encounter any major issues—but it’s not impossible.
To reduce the chances of encountering compatibility issues, you should check that you have the latest versions of all your themes and plugins:
- Log into your WordPress account, if you haven’t already.
- Navigate to Dashboard > Updates.
You can now view all the available updates.
While you’re here, you should also verify that you’re running the latest version of WordPress, by giving the Check Again button a click.
If an update is available, then make sure you install it.
3. Check PHP Compatibility
Once you’re running the latest version of all your themes and plugins, you should scan for any outstanding issues with PHP compatibility.
You can test your themes and plugins against various versions of PHP, using the free PHP Compatibility Checker:
- In WordPress, navigate to Plugins > Add New.
- Search for PHP Compatibility Checker.
- When the plugin appears, select Install Now > Activate.
- In WordPress’ left-hand menu, navigate to Tools > PHP Compatibility.
- Select the version of PHP that you’re planning to upgrade to, which will usually be the most recent version.
- Choose between the following options: Only scan active plugins and themes or Scan all plugins and themes.
- Give the Scan site button a click.
The plugin will now perform a scan, and report any compatibility issues with your themes and plugins.
If PHP Compatibility Checker does identify a problem, then you can either search for an alternative plugin or theme that’s compatible with the latest version of PHP, or you can reach out to the developer to see whether they plan to update their PHP support.
Upgrade Your Website’s PHP
Your version of PHP is set at the server level by your hosting company, so the process of installing a new version will vary between service providers.
If you’re unsure how to update your website’s PHP, then you can:
- Check your hosting provider’s website, documentation or help manual for instructions.
- Boot up your favourite search engine and search for update WordPress PHP followed by the name of your hosting provider.
- Contact your hosting provider directly, as they may need to update your website’s PHP manually.
If you’ve never upgraded your WordPress website before, then you may be wondering just how complex and time-consuming this process can be. Although it does vary between service providers, in this final section I’ll show you how to quickly and easily upgrade to the very latest version of PHP, using SiteGround.
Automatic PHP Updates With SiteGround
SiteGround provides managed WordPress hosting that’s officially recommended by WordPress.org.
By opting for SiteGround you can automate much of the setup and maintenance involved in running a successful WordPress website. You’ll also have access to some useful WordPress management tools, including Let’s Encrypt Standard and Wildcard SSL certificates, a built-in webmail interface, the SpamExperts service, and daily backups.
And thanks to our partnership with SiteGround, you can get up to 70% off the cost of your managed WordPress hosting.
SiteGround users can update to the latest version of PHP, in just a few steps:
- Log into your cPanel account.
- Navigate to 1H Software > PHP Version Manager.
- Select the directory where you want to apply this update. Note that when you upgrade a directory, all of its subdirectories will be upgraded automatically.
- Select which version of PHP you want to use, and then click Save.
Alternatively, you can tell SiteGround to automatically install new versions of PHP as they become available:
- Navigate to 1H Software > PHP Version Manager, and then select the directory that should receive these automatic updates.
- Select Managed PHP version.
- Click Save.
And that’s it! Your website will now always have access to the recommended version of PHP, without you ever having to update it manually.
In this article, we explored why PHP is so important for WordPress, and how you can prepare your website to ensure a smooth and error-free migration to the latest version of PHP. We also looked at an example of how WordPress hosting can provide you with access to the latest and greatest version of PHP.
If you want to learn more about how WordPress uses PHP, then check out why WordPress uses PHP. Or you might want to take your WordPress skills to the next level, with our Learn PHP for WordPress: First Steps course, where you’ll learn the programming language that powers WordPress.