Why I Upgraded My WordPress Website To PHP 7.2 And What Happened

WordPress Is Showing PHP Upgrade Messages

Is your WordPress website telling you that you need to switch to PHP7+ on your server? Here's what you have to do to upgrade and why. You are going to have to do this sometime and it's better to enjoy the benefits now.

If you’ve upgraded the WordPress core to version 5+, and you are still using an older version of PHP to run your website, likely you will be seeing messages in dashboard that you need to switch to PHP7.1+ on your server. 

Here's what happened when I did that on this website. It was not as easy as WordPress would like you to think.

More...

Hi, I’m Vossey from Online Business Builders and I’m going to show you what happened on my website when I tried this upgrade and what benefits I achieved from working through the issues I encountered.

What Is PHP and Why Does It Matter To Your WordPress Website?

First of all, what the heck is PHP?

The best analogy to describe PHP is that it's very much like the Windows or Mac operating system that runs your computer. So if you've got a Windows computer, it upgrades every now and then. And the Windows software allows you to run Word and Excel and all the other things that run on your computer.

Well that's kind of the same thing for PHP.  PHP runs on your web hosting and it allows the web hosting to deliver your WordPress website to your visitors. It does the same thing for a number of other content management systems like Drupal, and Joomla.

Remember the good old days of Windows 95? Some of you might remember that!

So Windows keeps upgrading. It's gone from Windows 95 to XP to V7 to V10, over time. And all of that allows improved functionality. And there are reasons for all of these upgrades.

1280px Windows 95 logo.svg

It's the same thing with PHP.

What Is The Role Of PHP?

Where PHP sits in the website world is shown in the diagram below.

The user goes to a web browser or Google and requests a website by typing in a domain or clicking on a link in Google.

That drives the browser to a domain name. The domain name registrar goes okay, so that's sitting over here on the hosting account and it sends a request to the hosting account.

The request gets picked up by PHP in the hosting account and causes WordPress to drive the database and to create the page.

Then HTML and CSS which are, the coding things that make it look nice, create the page. Then you get to see the website page in your browser. And on it goes.

Now all of that you want to happen very quickly and if it's a chuggy process or it doesn't look very good in the browser etc, visitors leave or they get frustrated.

Companies in the e-commerce space know that website speed is worth millions of dollars to them in revenue.  The same thing is relevant to lead generation websites. If people come to your website and it's slow they leave. It's as simple as that.

What Version of PHP Are You Using?

Here’s how you can see what version of PHP you are using:

  • If you have active support from your hosting company, ask them to tell you what version your are running
  • Or install a plugin called Display PHP Version which shows the version in the dashboard

Most WordPress Sites Are Still Using Version 5

Here’s the version of PHP most WordPress sites are using according to WordPress

There's a lot of websites that need upgrading to php 7.2 or higher. Looking at this chart there's still about a third of the WordPress websites still running PHP 5.2, and PHP 7.0 which are no longer supported versions.

When you come down to it, if you look at just the current versions that are using 7.1, 7.2 or the new 7.3, there's only about 20% of websites.

So there's a lot of upgrading needed to be done over time. This is going to be an issue that you and other website owners, hosting companies, and developers are going to be dealing with over the next few months.

What Are The Benefits of Upgrading PHP?

First, it's more secure. One of the reasons why WordPress plugins, themes and PHP get upgraded is because they become hacking targets.

Over time vulnerabilities are found in previous versions of PHP (and Windows, and Android etc). So the newer versions are much more secure and much safer in terms of the operating system. It helps in keeping your website up and operating and hack resistant.

Version 5 (all variants) and Version 7.0 are no longer supported. PHP says This is “a release that is no longer supported. Users of this release should upgrade as soon as possible, as they may be exposed to unpatched security vulnerabilities.”

Number two it is much faster.  Being faster has two benefits:

  • Firstly, it's better for your users.  If you website runs fast, your visitors are going to enjoy that experience more, they're going to look at more pages, they are more likely to either buy products if you're an e-commerce store or request the contact or become a lead if you're a lead gen type website.  So that's that. Faster websites just generate more business.
  • And the second thing is that because Google knows that people like faster websites, it's in the Google ranking factors. So websites that run faster are more likely to rank higher on Google search pages for a given search term, than websites that are slow. Having a fast website means that you're more likely to rank which drives more traffic to your website. So it's a double benefit in terms of lead generation and sales.

And on that basis, that's basically the business case. Security you can deal with because you can back up your website and restore if it gets hacked. But getting more leads, and getting more sales from better ranking and better speed is the business case. And you are going to be forced to do it eventually anyway.

Upgrading My Website: My Case Study

I’ve been meaning to update my website for a while.

But you know, my parents were nursery people and we had the worst garden in the street! You never get around to it.

So here’s my website Online Business Builders. It’s on shared hosting operating on PHP 5.6 with caching. I’ve done some things to try and make it go faster.

It’s loading at about 4 seconds with a performance grade D. And there are a number of reds there in terms of things I need to do on the Pingdom tools test.

pasted image 0 10

There’s a pretty similar result for another page.

You have to do all this analysis page by page.

But nearly four seconds again, and a whole lot of red results on that one as well.

pasted image 0 8

I also tested it on the Google page speed tools. Below, you can see the mobile version of the website sitting there on the right. And Google gives a 36 out of 100 and a slow rating. So it needs to be fixed.

pasted image 0 3

pasted image 0 1

And I’ve just bitten the bullet on it to get it done.

The Upgrade Path Was Not Straightforward

Now, this should be ieasy for me, I’ve got access to the Cpanel. I just go into the PHP selector and click on that little drop down and change it to 7.3 and set as current. Right and all done – simple. Not so fast!

pasted image 0 2

But before you do that on your own website, you might want to yourself or get your developer to install the plugin called PHP Compatibility Checker to see whether your website is compatible with the upgraded versions of PHP. That one will give you a warning if there’s going to be a problem.

For me, I’ve got access to the Cpanel. I just switch it to 7.2 and see what happens.

And what happened was this fatal error. The website completely goes offline and stopped operating.

pasted image 0 5

So simple, put it back to 5.6. And now I’m faced with the issue of what do I have to do?

The Process For Your Upgrade

  1. Note the version of PHP you are using.
  2. Test with the PHP Compatibility Checker for versions 7.1 – 7.3 and see if it works. If it does, then get the version of PHP changed and check your site. That might be all you need to do.

What If A PHP Upgrade Breaks The Site?

So the process you need to go through if your website isn’t compatible with PHP7.1+ is that you basically need to take a backup of the website and go and check what’s stopping it being compatible.

That could be a plugin. It could be a theme, or it could be some other coding on the website. And you don’t want to be doing that in a live environment. You want to take it off onto a development version of the site and upgrade it.  This is covered in more detail in this video from Themeisle

That’s basically what I’ve done with my website. I’ve taken the website (copy) off onto my development VPN server that’s based here in Sydney on Vultur, which is a really good server and it goes really fast.

I’ve upgraded the theme from an old Builder Theme to Generate Press Premium (which is light and fast) and I’ve taken some of the plugins out and reinstalled some others and actually adjusted the look at the website because I’ve been meaning to do that for a while.

It was the theme that was stopping it operating in this case.

What Was The Result Of The PHP And Site Upgrade?

So speed-wise it’s gone from nearly four seconds to just under half a second in load time. A 10 times improvement from all of those changes and performance grade B. I’ve done nothing else but change the theme, change a couple of plugins and leave it at that.

It’s running on a different server, the VPN server, and it’s running better software and thus 10 times improvement in speed.

pasted image 0 9

Testing it with Google lighthouse. It’s gone from 38 to 75 out of 100 on mobile. This was on my development server.

At this stage, I hadn’t installed it on the live domain yet. And from the desktop point of view, it’s gone to 84 from what was in the 70s somewhere.

pasted image 0 6

pasted image 0 11

So a vast improvement.

Remember this was running on a VPN, which is a fast server here based in Sydney.

Moving The Site To Live On Shared Hosting Slowed It Down

I moved it to (my live domain) on my shared hosting because I wanted to see what the impact was on the shared hosting server.

The load speed was still performance Grade B but it went from 0.44 seconds to 1.72 seconds.  Nearly five times slower and kind of half the time of the original site.

pasted image 0 4

Another page here on the website also has a load time of just under one second.

pasted image 0 7

So one or two seconds is OK.  But very likely I’m not going to leave it there (on the shared hosting).  I’m going to move it to the VPS hosting permanently and operate the site from there.

I like 0.4 seconds better than 0.7 seconds and I certainly like it better than 1.7 seconds for the other page.

What Did I Learn From The PHP Upgrade Process?

So what I've shown here is:

  1. Sometimes you can't just upgrade the PHP version, you actually have to do changes to your website to make it work.
  2. It does make a huge difference in terms of the load speed and the impact on the visitor and to the speed of the site.
  3. You get what you pay for, with hosting. Hosting on VPS is better than shared hosting and operates more quickly.

So if you want your site to run fast, you've got to go to PHP(7.2+). And you've got to be thinking about where you're hosting the website as well because that clearly is a core driver of the speed.

The Payoff Of The Upgrade

Now remember the business case is; more secure, more leads, and better ranking. All of that is just the reason for upgrading PHP.

It's a one-off change. We maintain our cars, we maintain our houses, we maintain our computers, and we upgrade our phones. We have to do the same on our website.

I hope you found this beneficial. Please let me know what you thought or if you have any questions in the comments below.

Leave a Comment

Call Now