How to Update Your PHP Version to Keep in Line with WordPress Recommendations

Posted on June 3, 2019 by in WordPress | 14 comments

How to Update Your PHP Version to Keep in Line with WordPress Recommendations

When a WordPress website is loaded, it runs on code. Once upon a time, that code was strictly HTML. Now, it’s a few different things, typically CSS, HTML and JavaScript.

That’s the front-of-the-house, though. The waitstaff that all visitors see. Back-of-the-house runs a bit differently; there are different cooks in the kitchen, and they influence a little bit of everything.

When it comes to WordPress, the programming language PHP is what’s really running the show. You’ll find PHP in everything from your WordPress dashboard (back end) to your website page templates (front end). PHP is also in your plugins, your theme… basically, your website doesn’t exist without it.

Subscribe To Our Youtube Channel

What is PHP?

PHP is an open source, free-to-use programming language, and because it’s so accessible, it’s one of the most-used programming languages in web development (Facebook uses it, too).

Here’s how the back-of-the-house impacts the front-of-the-house: PHP essentially takes information from your database, packages it as CSS and HTML, and then creates your gorgeous site for visitors to see.

PHP exists on the server end of things. To compare, something like JavaScript is processed on the client-side of the website, in the browser when someone visits your site. If a website problem is due to a PHP issue, you have to be the one to fix it (or your host does, at least) – even a super fast computer can’t quickly process PHP from a slow server.

The moral: PHP is pretty damn important, especially if you have a WordPress site – at least a WordPress site that you want to perform well.

PHP Requires Updates

Since PHP is central to WordPress, it’s always being tweaked and improved – there have been a lot of versions over the years. As of the writing of this article, you should have at least version 7.0, though 7.3 is the most recent version. By upgrading, you’ll access the newest PHP version, which also means the fastest, safest and just plain better version.

update PHP

Source: php.net

The biggest changes with PHP 7 are that it’s approximately twice as fast as the last version, PHP 5.6; code is easier to read and support; script problems are resolved smoothly; and its applications are more difficult to hack.

P.S. If you continue using an older PHP version, you won’t be able to access active support any longer, and security support will eventually run out, too. Translation: your website won’t be safe and you won’t be able to get any help with it should something go wrong.

Let’s Check Your WordPress PHP Version

Before you update your PHP, find out if you even need to by determining the PHP version you have right now. There are two simple ways to do this:

Check With Your Host

This is what I did. Actually, what I technically did was email DreamHost to say, “Umm, my website seems to hate me lately.” And they were like, “Yeah, it’s mad at you for having out-of-date PHP.”

If you can’t get a hold of your host’s customer service, you can probably check the version yourself. Look for something like “PHP Settings” or “PHP Version,” or “Manage Domains.”

In DreamHost, you can find out the version on the Manage Domains page.

update PHP

Use a PHP Version Plugin

You can use a plugin like Display PHP Version, which is possibly the easiest thing I’ve ever done when it comes to WordPress.

update PHP

You just install, activate and then see the version you’re using in the At a Glance section on the Dashboard:

update PHP

Is it Time to Upgrade Your PHP Version?

You found out the worst news possible and it’s time to upgrade your PHP. I’m going to assume your host will let you upgrade – if they don’t, it’s time to break up with them.

It’s always a little risky to upgrade because it’s possible that your website contains code that the new PHP version won’t be compatible with. If that happens, some or all of your website could behave strangely post-upgrade.

Let’s go over how to prevent that from happening.

You can do this on your live website, but an even safer solution is to make a local copy of your website and go through the process on that first as a test run.

Upgrade Everything (but Backup First)

Since PHP issues usually have to do with old code, it’s best to upgrade your plugins, theme and WordPress version before you do anything else. Also, you probably know this already, but you should always backup your site before updating anything.

update PHP

We’ve written a lot about backing up your WordPress site:

Double-Check Compatibility

Upgrading everything that’s out-of-date is a good first step, but it’s not foolproof. Luckily, they make a plugin for that. (There’s also the PHP Compatibility Checker from WP Engine, but it’s untested with recent WordPress versions.)

update PHP

Install, activate, click the SG Optimizer link in the left-hand sidebar of the Dashboard, then click on Environment Optimization. Partway down the page, you’ll see the recommended PHP upgrade and a link to “Check Compatibility.”

update PHP

It took under 10 minutes (for my simple website, at least), and then I get this notice, so it looks like I’m good to go:

update PHO

Upgrade Your PHP

Guys, it’s time to take the plunge.

There are a few ways to upgrade your PHP. Some are pretty advanced, like using SSH commands – but if you know how to do that, then you don’t need me or this article.

Instead, we’ll do this the easy way – by using that hosting service I get billed for every month. As you know, I use DreamHost – here are the directions for upgrading your PHP through them. If you use another host, you shouldn’t have trouble finding their directions, and it’s likely not going to be too different from how I’ll upgrade mine.

I go to Manage Domains, click “Edit” near the one I need to upgrade, then find the PHP upgrade options under Web Options.

upgrade PHP

DreamHost suggests PHP 7.2, so that’s the one I choose. Then I save the changes and get a notice that the changes should take place in about 10 minutes. I go back to WordPress, clear the cache and the PHP is updated – two minutes, tops.

upgrade PHP

Make Sure Everything Looks Right and Functions Correctly

Even if you’ve done your due diligence, websites are known to be imperfect. Once your PHP is updated, head over to your site to check it all out. Click each page, test the features and plugins, etc.

Wrapping Up

Upgrading your PHP version is part of WordPress best practices, just like upgrading your plugins and theme. That said, I have had “update PHP” on my calendar for a month. Maybe two months. Every Monday, I move the date. “Nah, next Monday.” Had I known how simple it would be, I wouldn’t have dreaded it so much. And isn’t that applicable to so many things, WordPress and beyond? The safety and performance of your website rely on these small tasks – keep on top of them, get them over with and get on with creating content people love.

Did this tutorial give you the development bug? Check out 10 PHP Tutorials Aspiring WordPress Developers Should Walk Through.

Premade Layouts

Check Out These Related Posts

GamiPress: An Overview and Review

GamiPress: An Overview and Review

Posted on August 19, 2019 by in WordPress

Keeping your bounce rate down is important. Making sure visitors return to your site can be equally important. With both of those metrics combined (a user engaging with your topic multiple times), the likelihood of conversion is much higher than it would be otherwise. One of the most effective (and...

View Full Post
How to Create the Best Sponsorship Page Possible

How to Create the Best Sponsorship Page Possible

Posted on July 28, 2019 by in WordPress

If you are looking for how to get sponsored, you likely rely on donations or sponsorships for funding. And making sure that you are asking the right way is integral to your success. You must make sure that you lead your sponsors to the decision to hand you their money in the best way possible....

View Full Post

14 Comments

  1. Very helpful article!It will take at least 20 minutes before the changes are in effect in my case.

    • Thanks for your comment, glad you found this helpful!

  2. Upgrading the PHP version can definitely break a website pretty bad. I remember one time i was updating a page that was not taken care off for 3 years and after updating it, it completely broke in dozens of ways. The only way was to recreate the website with an up-to-date WordPress install.

    • Yikes! And thanks for your comment, Pascal!

  3. Hosting companies all handle PHP7 updates differently, so when in doubt reach out to your hosting support and ask them for instructions. Ideally, you should stage your website on a development server to test for incompatibilities prior to switching your live site. Otherwise, if you are going to wing it, make sure that you can go back and downgrade you PHP version should you have a plugin or theme that doesn’t work with the new PHP version. In all cases, make sure you have a backup of your files, and your database!

    • Agreed, on all points! Thanks so much for your comment, Dana.

  4. It should be pointed out that PHP 7.0 is also no longer supported with security updates. So the minimum people should be upgrading to is 7.1.

    • Very good point, thanks for commenting, Mike!

  5. A few tips:
    – You don’t need a plugin to display PHP WordPress version. Just navigate to Tools > Site Health > Info > Server
    – And while I would never advice NOT to take a backup before upgrading, remember that PHP version upgrades is like a switch. If your hosts control panel allows you to upgrade from from 7.1 to 7.3 by flipping a switch, you can test your site, and flip back to 7.1 should you encounter any issues that needs taken care of.
    – Ask you plugin or theme developer if their product is PHP 7.3 compatible. Most likely you will get a usable answer recommending you to update.

    • Thanks so much for the comments and advice, Bjarne 🙂

  6. perfect, but I have a question, how do you update PHP from WHM for all webs within the “reseller”? .. in my case via Cpanel only gives up to 7.1 … and the person who manages the WHM has no idea how to do it … is there a tutorial to do it myself?

    • I found couple of tutorials with a quick Google – not sure if they’re what you’re looking for (there are several, so I didn’t pick out one link), but may be worth a search!

  7. In my case it worked only with PHP 7.1 … …i will upgrade all my sites . Tank’s Pietroluonga !

  8. Hi there, I use Siteground, so jumped into optimiser to see what my environment optimisation said. It says running on PHP 7.1, yet when I view the wp dashboard, at a glance, it says WordPress 5.2.2 running Bare bones for Divi theme. So I’m confused! I was following a tutorial about adding some php to make a footer layout work for all pages, and it said to go into appearance, theme editor and then further instructions. When I click the theme editor, i get a pop up box saying: Heads up!
    You appear to be making direct edits to your theme in the WordPress dashboard. We recommend that you don’t! Editing your theme directly could break your site and your changes may be lost in future updates. If you need to tweak more than your theme’s CSS, you might want to try making a child theme.

    If you decide to go ahead with direct edits anyway, use a file manager to create a copy with a new name and hang on to the original. That way, you can re-enable a functional version if something goes wrong.

    What I don’t understand is that my active theme is the Divi Child Theme. Do you know how to remedy this? thanks!

Join To Download Today

Pin It on Pinterest