Supercharge Your Site: How To Update Your PHP in WordPress
Faster than a speeding bullet! More powerful than a locomotive! Able to leap tall buildings in a single bound! Okay, maybe not that last part. However, when you keep your PHP up to date, you inherently enhance your website’s performance, security, and SEO. That’s pretty super in our opinion.Oct 2020: We tested all the best WordPress hosts! Find out how we compare.
In this article, I’ll be going into why PHP is crucial for WordPress, how it works, and how to keep it current.
Plus, we’ll show you some additional solutions to keeping your PHP in shape. You’ll then know what steps to take to ensure your site isn’t crime-ridden with bugs, slowness, and insecurities.
Your site will be such a hero for protecting its assets and keeping everything running smoothly, it may just have to wear a cape…
What is PHP?
To give you a quick backstory on it, we’ll go back to 1994, when PHP was originally developed by Rasmus Lerdorf in the mean streets of, well, I don’t know for sure (and I don’t know if they were ‘mean’).
Since then, it’s become one of the most popular scripting languages for the web.
The name was originally derived from Personal Home Page/Forms Interpreter. It’s a script language and interpreter that is freely available and used mostly on Linux Web servers.
Put simply, PHP is a programming language used on websites. However, what’s unique about PHP, is that it’s a server-side language.
You see, websites use two types of languages. There’s a client-side language, and then there’s the server-side language.
So what’s the difference?
PHP, on the other hand, does all of its work on the server, where your site is hosted.
WordPress uses PHP so that it’s possible to interact with the database and to retrieve data. What that means is it uses PHP to get things from the database and then to output them as HTML.
A variety of PHP tags and functions that WordPress provides is what enables this to occur on your page.
PHP is beneficial with WordPress because it’s your link between your web page and the database.
If a visitor requests a page on your site, WordPress will interact with the database on the server-side and — kazam! — output the page.
Instead of using static HTML for each page, PHP generates pages dynamically. This simplifies things by saving you the time and hassle of creating loads of static web pages for your site.
Up, Up-date, and Away!
Now that you know what PHP is… what’s with the updates, and why are they important?
First, to be clear on what we’re looking at, let’s start by mentioning that PHP uses a point versioning system to manage its releases.
The first digit is the major version, the second digit is the minor version, and the third digit is the release version.
So, let’s say it’s version: PHP 7.4.3 that was released in February 2020.
7 represents the major version, 4 represents the minor version, and 3 is the release version.
There are three main categories for support when it comes to these versions.
- Active Support: These versions are actively supported. That means when bugs or security issues get fixed, regular point releases occur.
- Security Only: Versions where there’s just support for critical security threats and releases and are made as-needed instead of on a schedule.
- End of Life: When versions are no longer supported and can be exposed to unpatched security susceptibility.
Many updates have rolled out since 1994, and it’s important to keep up with them because of these three major reasons. Otherwise, your site will eventually collapse in defeat.
How to Check PHP Version in WordPress
It’s simple to find out what version of PHP your site is using. You can access this information right from the WordPress dashboard.
Go to Tools > Site Health first.
This will tell you the status of your site. As you can see, in this example mine is Good.
Also, some recommended improvements are displayed, and if your PHP is outdated, this would also display here.
From this point, you can check your version of PHP by clicking the Passed Tests.
It even has a dropdown to learn more about PHP and for additional information.
Save The (Up)Date
To quickly recap… we now know why updates happen, and where to find your version of PHP in WordPress.
But one other thing to mention before we continue, is that necessary updates for plugins, themes, etc., don’t always happen.
PHP falls into this same boat. And the reality is, many businesses, hosting providers, sites, and developers are not supporting the latest version of PHP.
Sometimes it’s simply due to laziness, other times it’s a lack of resources (e.g. funds to provide a developer to upgrade).
Common reasons why the latest PHP version is not being supported:
- It’s too time-consuming for plugin and theme developers
- Website owners are unaware (or don’t mind)
- Web hosts don’t want to risk breaking sites
It goes without saying, older PHP versions will be more vulnerable to security risks.
The newer versions have ways of handling bug fixes and also new language features. All of this can also help improve the performance of your applications and lower resource usage.
At the same time, this helps reduce server costs and makes the server more beneficial for users.
Any bug fixes also improve application performance by taking care of errors (e.g. user-facing errors).
It’s not rare for legacy applications to include error logs that have warnings. In many cases, this can all be cured with an easy version upgrade.
Finally, you need to take steps to upgrade PHP yourself or ensure your hosting provider will help you.
Luckily, with good hosting, it can be done practically for you. For example, WPMU DEV Hosting uses the latest PHP version.
Prepping For PHP
It might be scary thinking of updating your PHP when some developers avoid it in fear of screwing up EVERYTHING.
Okay, maybe that’s a bit dramatic. And the truth is, it’s not that scary and you shouldn’t worry.
There’s no guarantee that you won’t run across any problems. WordPress works with PHP versions from way back to 5.6.20, and it’s hard to tell for sure if your themes and plugins will function.
Of course, they should. Any good, reputable themes and plugins should be alright, but it’s no guarantee.
However, there are a couple of things you can do to mitigate your risks before moving forward.
1. Make a Backup Of Your Website
In case all hell does break loose (which isn’t likely), this will let you revert to your site to how it was.
A good plugin to backup your site will do the trick. You can also create a copy of your site by exporting all of the files and a copy of the database.
Use SFTP for your files and export a copy of your database using MyPHP.
Keep in mind you might be able to use your last backup, too.
2. Update WordPress, Plugins, and Themes
You can do this from your dashboard by heading to Updates and then Updating All.
If you happen to be a WPMU DEV premium member, you can update from The Hub by clicking Update Everything. (And P.S. — our plugins are always up-to-date.)
From here, you can also see what PHP version you have. Just click on Overview and it has all of the information available immediately.
It’s an easier way to view all things PHP.
Whether you’re a WPMU DEV member or not, now you have your site backed-up, done due diligence, and are ready to update.
How To Update PHP With cPanel
cPanel is a very recognizable hosting management dashboard interface. It’s found on most shared hosts.
So, if you need to update PHP for yourself, chances are you’re on a shared hosting plan and this video should help.
If your host doesn’t use cPanel, we’ll cover that coming up soon.
Updating PHP in WordPress
If your host allows it, you have a couple of options when updating in WordPress. You can create a local or staging site.
To get you set up on your local computer, we have an article on how to set up XAMPP that can help you accomplish this.
When your testing environment is all set up, you can add the files and database from the downloads that were mentioned earlier. This way, you’ll have a replica of your live site.
Once you’re all set up with a copy of your site in your testing environment, you can upgrade the PHP version of your testing site.
Ensure all of your plugins and themes are compatible with the new update. Go through your test site and make sure nothing is broken.
Test out everything; including checkout processes, web forms, navigations, and all other features that you can check off the list that contribute to your bottom line.
The Stage is Set
With our hosting, it’s quick and easy to test your site before updating your PHP. We have the option to set up a staging site available on our dashboard under Staging.
Go to Staging, select your PHP Version, and testing in the staging site before moving to production is best.
Then to get moving, click Start to copy your production site over. It takes just several moments for it to get set up.
Once it’s ready to go, you’ll have three staging options:
- Move Staging to Production
- Reset Staging
- Delete Staging
You’ll have two options for what you want to push once you click Go:
- Files & Database
When you decide on an option, click Next Step.
After that, your staging site is ready!
You’ll have a custom URL for staging and can get to work. Plus, there’s peace of mind in the form of a pre-staging push backup, in case things go wrong.
At this point, you can test out everything and update accordingly.
‘Check’ This Out
Something else to consider when it comes to helping with testing is the PHP Compatibility Checker.
This plugin will give you a report of compatibility issues for you to fix before updating. They’re all categorized into errors and warnings.
It will list the file and line number of the offending code, and also the information about why that line of code is incompatible with the choice of PHP.
It even goes as far as suggesting updates to themes and plugins to replace the ones that aren’t up to date.
You can download the PHP Compatibility Checker here.
Live Site Update
And now it’s time to go live.
When you’ve tested all the bugs and issues with compatibility and adjusted accordingly, you’re ready to update the live site, and update the newest version of PHP.
Since PHP is set at the server level by whatever hosting company you’re with, updating means that you’ll have to interact with your host’s settings or request that they do it for you.
In other words, a lot of how to do an update depends on your hosting company.
That’s right. I can’t just tell you here exactly how it’s done without knowing who your hosting provider is.
But don’t worry…
Most host providers make it simple.
Any good reputable hosting company makes it a breeze to update PHP, and easy to find their specific information on how to do it.
You can typically find the information out in their FAQ on their website or you may have to reach out to their support.
GitHub also has a handy resource guide for specific companies, and how they each do their updates.
Once you find out how it’s done with your hosting company, it should be a simple click of a button (or two) to get updated.
It’s a Bird! It’s a Plane! It’s Up-to-Date PHP!
You should be flying high now with an updated PHP.
As you can see, it’s easy to get your PHP up-to-date for WordPress. There are a few factors, precautions, and ways of doing it. A lot of it depends on you and your host.
A good hosting company should help you keep your software up-to-date in the most effortless way possible. It shouldn’t be something you need to remember to do on your own.
Here, at WMPU DEV, members get unbeatable, world-class, blazing-fast hosting. And our own heroes are here to help you update your PHP with a click of a button.
Plus, we also backup your site daily, assist with caching configuration, monitor uptime, and you’ll have access to all of our premium, up-to-date plugins.
It would be a crime to have a WordPress site not updated with the latest PHP. Luckily, you can rest easy knowing that your PHP is up to date.
Bugs will be smashed, it laughs in the face of slow speed, and users are su-PHP-er happy.