WordPress runs on PHP, among a few other things, to generate web pages, process data, and access its database. While PHP has been around for a long time, it is periodically updated with new features and you need to update your server for the new version. In this article, we will go over how to update PHP in WordPress (or, more accurately, on a WordPress server.
First, we’ll go over what PHP really is and why you want to keep it updated. Then, we’ll give you instructions on how to update it. If you want to skip right to the directions, click here. Just be careful before updating it, it requires you to work on the server itself. While PHP definitely affects how WordPress works, you can’t change PHP very much from within WordPress.
What Is PHP?
A simple way to think of PHP is that it’s a programming language that runs on your server to give WordPress much of its functionality. WordPress works with a few different “languages” to do everything that it does. Some run on your computer (in your browser) and others, like PHP, run on the server itself.
PHP is the language that WordPress uses on the back-end to do logic and presentation and such. For example, when a user tries to load a page, it’s PHP that looks at the URL, then checks your database (and maybe your functions) and looks to see if you have that page content. Then, it adds your header and your footer puts it all together and sends it back to the user. That’s a bit of a simplification, but it gives you the idea.
PHP runs on the server and does the back-end logic work for your WordPress site. It’s basically the programming language that your server uses to put together your site and send it to the requesting browser.
Why It Is Important to Keep PHP Up to Date on your WordPress Server
PHP has been around a long time, almost 30 years which is an eternity in computers. This means that it is pretty stable. It’s not as fast as some newer languages but it works well and lasts a long time so a lot of Content Management Systems, like WordPress like it. It also requires only very basic infrastructure to run.
However, as needs change and more people use it, new features and commands are added. Periodically, security holes are fixed or security improvements are made. To do all this, PHP is updated. They will periodically add these new commands, change old ones and even get rid of a few.
However, to get rid of commands, they’ll mark them as deprecated. That’s a fancy term that warns developers that the command won’t be available in future versions. Eventually, then, they’ll take it out of a later version. If you’re still running something that uses that command and you upgrade PHP, it will fail. If your software tries to use a newer PHP command and you’re running an older version of PHP, you guessed it, it will fail. So your software (plugins, WordPress, etc.) and your PHP both need to be built to work together.
New features aren’t the only benefit of updating your PHP version on your server for WordPress. The developers of PHP are always looking for ways to make it faster too. In a world of Core Web Vitals, better hardware, and more complicated sites, we are always looking for ways to make things faster. PHP is a big part of that. For example, going from PHP version 7.4 to 8.0, version 8.0 was able to process over 230 requests per second, compared to the 197 requests per second of PHP version 7.4 which had a similar increase over the version before. So, you get an improvement of about 18% just for upgrading PHP.
That means pages load faster, the site responds faster and you can do more with it. This kind of improvement isn’t uncommon between versions. This is a nice bonus when it works (and all your software takes advantage of it.) You can get a measurable speed improvement with a bit of work.
For all these reasons, you want to keep your server up to date with a later version of PHP. You may not always want to jump right to the latest version of PHP until your plug-ins and WordPress have caught up. This is especially true for bigger version changes.
The bigger the version number change in PHP (or almost any software) the bigger the changes in it and the more risk to updating. So, going from version 7.4 to 7.4.1 is a small change and not very likely to cause issues. Going from 7.3 to 7.4 is bigger but not always a big risk. Going from 7.4 to 8.0 is a big change and it may take some time for your plug-in developers and WordPress to catch up and work out the kinks.
PHP generally keeps supporting older versions of PHP for a while, so you don’t have to update right away. Don’t wait too long. Over half of all WordPress sites are running on versions of PHP that aren’t supported anymore. They aren’t supported by WordPress or by PHP so these are sites that are a ticking time bomb. They could fail at any time. These are all sites that will require more work (and maybe the help of a developer) to update.
What Happens if I don’t Update PHP in WordPress
If you don’t update PHP, eventually, you will start to have problems. The operating system (usually UNIX), PHP, WordPress, your plug-ins are all designed to work together. It’s a bit of a Jenga game. If you keep everything up to date then all the blocks will be in the right place. However, the further away from being up to date you get on anything, the more you are pulling out blocks and things won’t work.
This is especially true if you update or add a plug-in or new version of something on your site. Also, many hosts will eventually update PHP or the operating system. Having these out of date can lead to security issues, stability problems, and systems and sites crashing. Your host doesn’t want to be responding to complaints because the Jenga tower crashed, so they do their part to keep the blocks in order.
By keeping things up to date, you keep adding new blocks to the bottom of your Jenga tower and things should stay working. You don’t necessarily need to be on the very latest version of everything, but you should be close.
Common Errors in WordPress Associated with PHP being Out of Date
Having a server with an out-of-date version of PHP can cause any number of problems in WordPress, especially if it’s very old. In some cases, you may even see something called a 500 Server error. This means that there is a problem in the code or system that won’t let WordPress function.
This is an extreme case and may require a developer to help you fix it. This is most common when PHP or WordPress are very far out of date and can require some effort to fix. Let’s hope things aren’t that far along.
A more common scenario is that WordPress tells you right on that dashboard. It will give you a warning that PHP is out of date and that you should update it. This is most common when you are far enough behind that WordPress will still work but there is a newer version that you should upgrade to.
If there have only been minor changes in PHP since you last updated it then WordPress may not tell you on the dashboard. You may have to dig a bit more. The good news here is that if you need to go look for it, it’s not a big problem and you aren’t in a hurry.
On the left menu of the admin screen, you will see an option for Tools. Select that and then select Site Health. This will give you a list of things that WordPress thinks need fixing. When you’ve opened that up, first, don’t panic. WordPress will often give you this list of things that you should do. Sometimes these are critical, but more often they are minor issues.
You should probably consider fixing most of them, but often they aren’t as time-critical as WordPress might make you believe.
One thing you will often see there is a warning about PHP. It will tell you the current version and give you a link to resources where you can learn more.
These aren’t all the issues you might see. Depending on your version of WordPress, PHP, plugins, themes, etc. you could see any number of issues. These cover most of the big ones though and these can help you recognize when you might need to update PHP on your WordPress server.
Now let’s talk about how to do that.
How to Update PHP in WordPress
With all that in mind, let’s jump into how to update it. We’re going to focus on C-Panel hosts (like A2 Hosting) and Siteground, which are our two preferred hosts. Other servers might require a bit more work.
First, Backup Your Site
Not every version of WordPress and your plugins work with every version of PHP, so you want to make sure that you backup your site on your current version of PHP. That way, you have a site that works in your current version of PHP.
You also want to make a note of which version of PHP you’re running on now. That way, if you need to change things back then you can hopefully switch back. You’ll need to know which version to switch back to.
We recommend Updraft Plus. It’s a great solution that makes it easy to backup and restores your system. The free version often works just fine for this.
Next, Update Your Site
This is where things usually start to break, so proceed with caution. Usually, WordPress itself does a good job of staying up to date with the latest version of PHP but some plug-ins aren’t as good about it. You’ll want to make sure that you’re on the latest version of things before you update PHP in WordPress.
It’s a really good idea to try this first on a staging site, where you make a copy of your site and do the work there. That will give you a chance to work through any issues before you potentially break your site.
You might also want to take the time to see if your current plugins support the new version of PHP. Most plugins are listed in the WordPress repository and will have a version of PHP that they are tested to. When you select a plug-in, you’ll see a section in the sidebar that tells you some key things like how often it’s updated, the version of WordPress it works with, and…you guessed it…the version of PHP that the developer says they have tested it with.
This happens because sometimes new versions of PHP will change and remove commands from previous versions. They do this with a lot of notice, but some developers don’t keep up with the changes and the new version of PHP breaks the plugin in weird ways (or just breaks it completely).
If your site is really out of date, updating the plugins and WordPress is sometimes where you start to see issues. You might have to rebuild pages, change the functionality, or do other things, so test your site carefully. It’s a good idea to do this before you update PHP in WordPress because otherwise if you have problems in the next step you won’t know whether the new plug-ins or the PHP change broke it and you’ll have to undo everything to diagnose it.
Now We Can Get to Work
Okay, so that’s all done. Just like with the plug-ins and WordPress, it’s a good idea to do this on a staging server. Fix the problems and know what to expect before you do it on the live site. Often, things go fine but sometimes things break. Expect the unexpected.
Before we give you the more complicated instructions, let’s start with the easy way. Sometimes, it’s as simple as contacting your hosts’ support and asking them to update PHP for your site. Some hosts don’t stay up to date on the PHP versions on their server. Normally, this is fine, just update to the latest version they have available.
How to Update PHP in WordPress with a C-Panel Host
If you want to do it yourself or your support won’t do it, then here’s how you can do it on a C-Panel host like A2 Hosting and many others. Your interface may look a bit different.
- Log Into Your C-Panel
- Find the Select PHP Version App in C-Panel
Either by typing CTRL-F and searching for PHP or just looking for it, find the Select PHP Version app in C-Panel. Click that.
- Change the PHP version. At the top is a dropdown to change the PHP version. Select the one you’re looking for, often the latest but not always. If it’s a whole number change (e.g. 7.4-8.0) give it some extra time to let all the developers catch up. The bigger the difference in numbering, the more different the versions and the more likely there will be errors. So, 7.3-7.3.1 is not a big change but 7..3-8.0 is very big. Change the dropdown and select Set as Current.
- There you go….sort of.
Now you need to check your site and see if you have any issues. With so many plug-ins out there, we can’t give you specific directions on fixing those issues. If you have up-to-date plug-ins, there should be any issues but some older sites will have many problems that may require more help.
How to Update PHP in WordPress on Siteground
Updating PHP on Siteground is similar to doing it on C-Panel. It’s a bit easier, in fact.
- Log into your Siteground account.
- Select Websites at the top.
- Find your website (for most of us, there is only one) and select Site Tools in the lower left by your site.
- Now you’re in the hosting management area for your site. On the sidebar is a menu. Select Dev.
- This opens a new menu below Dev. Select PHP Manager. A new screen will open up.
- On the next page you can select your PHP version.
At the top is the option to select your live site or your staging site (not all plans have this option). It’s a good idea to try with the staging site first. Select the one you want, if it’s an option.
- Below that is how you change your PHP version.
Select the pencil below Actions and a new dropdown will open up. Pick the version you want. You may see that some versions are “To Be Deprecated”. Deprecated is a technical term that basically means it’s an old version and won’t be around much longer. DO NOT PICK ANY OF THESE.
- Press CONFIRM and there ya go. You’ve updated the PHP version on your WordPress site.
In this article, we’ve gone over how to update PHP in WordPress on C-Panel hosts and Siteground. It’s not technically tough but when you update an older site, you may have some issues that you need to fix. These can take some technical know-how to fix. Sometimes, it’s a simple as updating WordPress and your plug-ins.
Keeping your PHP version up to date will help you keep your site secure, faster, and in good working order.