How to Easily Check and Update the PHP Version of Your WordPress Site

All websites are running on code. In the old days, it was pure HTML, today it’s usually a mix of that plus CSS and JavaScript.

However, that’s only once they are loaded. On the server, a different programming language is likely running the scene, especially if you have a WordPress website. We are, of course, talking about PHP.

Most of the things you see on both the front and back end of your WordPress site exist thanks to PHP. You don’t only find it in your page templates, it also makes up the files that build the WordPress dashboard.

The same is true for any themes and plugins you may have installed. In short, without PHP your WordPress website would not exist.

Because this programming language is so central to the WordPress platform, today we want to talk about something that many of us deal with too rarely: how to update the PHP version of your site.

What, you didn’t know that was even part of running a website? That’s exactly why this post exists. In it you will learn a little more about PHP as a language and why it’s important to run the latest version, how to check your site’s PHP and how to upgrade it safely.

Ready to get a little nerdy? Then let’s dive right into it.

A Short Overview of PHP as a Programming Language

Just so you know what we are talking about, let’s first dive into what PHP is exactly.

First of all, it’s a programming language that is open source and thus (like WordPress) free to use. That might also contribute to the fact that PHP is one of the most popular languages for web development. It not only runs the scenes behind WordPress but is also a part of Facebook and other popular sites. However, you can use it for other purposes as well.

who uses php
Source: James Titcumb

A second important thing about PHP is that it’s a server-side programming language. That means, it is processed on the machine whose hard drive it lies on. That is opposed to client-side languages like JavaScript, where all the work happens in the browser of the person requesting to see your site.

However, that also means that any problems with site performance that stem from PHP are yours to fix. Your visitors can have the fastest computer in the world, however, if your server is low on resources, that’s not gonna make much of a difference. Which brings us to the next part.

Why Update the PHP Version of Your Site?

Because PHP is so important to WordPress, it’s also a central part of site performance. After all, PHP is basically the middle man pulls the correct data from your database, wraps it in HTML and CSS and then delivers it as a finished site to the visitor’s browser. If the middleman is slow, so is everything else.

Updates Mean Improvements

For that reason, the programming language is constantly being improved upon. It has seen quite a bunch of versions throughout the years.

To run WordPress, your server needs at least PHP 5.2.4. However, by now the official recommendation is that you run PHP 7 or higher (the current version is PHP 7.1).

That’s because, just like WordPress, new versions of PHP bring a lot of improvements with them. As it progresses, the languages gets more secure, faster, leaner, less resource hungry and just overall better. In fact, just the jump from PHP 5.6 to PHP 7 was a great leap forward.

PHP 7 is the Best One Yet

One of the main improvements PHP 7 offers to WordPress users is increased speed. Benchmarks show the new version to be up to twice as fast as its predecessor.

php 7 benchmarks update php version

As a consequence, your server is able to deliver your website to more visitors while doing less work (by the way, there are more things you can do to speed up WordPress). In addition to that, the new version makes code easier to read (and thus support).

Furthermore, PHP 7 has gotten a lot better at handling errors. It is now able to resolve script problems without necessarily having to terminate the entire process. That’s good news to those site visitors who don’t like to deal with faulty websites (hint: that’s all of them).

Finally, PHP 7 has seen improvements in terms of security that make applications built with it harder to hack (if that ever does happen, learn how to recover from a hacked WordPress site).

Older Versions are No Longer Supported

In addition to the above, the lifetime of older PHP versions is running out. Active support for version 5.6 ended at the beginning of 2017. Security support will only be provided until the end of 2018.

Convinced yet? And those are just the cliff notes. There’s more awesome stuff that has improved in PHP 7 that you can learn about here. However, how do you figure out which PHP version your site is currently running on? I’m glad you asked.

How to Check Your WordPress Site’s PHP Version

If you want to know which version of PHP currently powers your WordPress site, you have several ways to find out. Let’s go over them real quick.

1. Check Your Hosting Management Panel

Your first option is to check with your provider. In the back end of your hosting account, there’s likely a menu called PHP Settings, PHP Version Manager or something similar. From here, you can check which PHP version your site(s) are using.

Most often you are also able to upgrade to another version here (more on that below) and do things like edit PHP.ini. The latter is an important file that allows you to make changes to server functionality.

2. Use a WordPress Plugin

Of course, in the WordPress ecosphere, you also have plugins that can do the same for you. One of the easiest to use is Display PHP Version.

Pretty much all you have to do is install the plugin and activate it. You will then be able to see the current PHP version under At a Glance in the WordPress dashboard.

display php version wordpress plugin

If it turns out that your server is already running the latest version, there’s nothing to do but smile happily and move on with your day (or maybe send your provider’s sysadmins a box of chocolates).

However, if you have never dealt with this issue before, chances are good that the PHP version is not up to date. In that case, we will show you how to upgrade it safely in the following.

Of course, that requires that your provider offers the option to switch. If not, maybe it’s time to find new hosting?

How to Upgrade PHP Safely

As cool as PHP 7 is, there are some risks involved with upgrading. That mostly means the possibility that you have code on your site (meaning in WordPress core, themes, plugins, and scripts) that is not compatible with the new version.

If that is the case, when you make the switch, all or parts of your site might break or at least show faulty behavior. That’s why it’s important to check this kind of thing beforehand and we will show you how below.

Quick note: the process laid out here is how to upgrade your live site. However, an even better idea is to create a local copy of your site and run through it once on your computer. That way, you reduce the chance of running into any nasty surprises even further.

1. Back Up and Update Everything

As mentioned, problems with upgrading PHP usually stem from older code that is no longer compatible with the newest version. The best solution: upgrade your site.

The WordPress community is a strong advocate for using the latest version of PHP. For that reason, core, plugin, and theme developers make sure their work jive with it.

Consequently, the first step to make sure site doesn’t produce problems is to keep your site up to date. That’s something you should do either way for security reasons.

So, back up your site and then click the upgrade button wherever necessary. Do it now, I’ll wait.

2. Use a Plugin to Check for Compatibility Issues

Done? Cool, then let’s continue.

Even with up-to-date WordPress and extensions, there is no guarantee that everything will go over smoothly. Thankfully, you don’t have to just have to hope for the best. Instead, you can test for incompatibility issues beforehand. How? With a plugin of course.

WP Engine has released a free plugin in the WordPress directory, for just this purpose. It checks all the code on your site and reports any possible issues.

To use it, you first have to install it on your site in the usual way. When it’s active, there will be a new menu item under Tools called PHP Compatibility. Here, just choose the PHP version you want to upgrade to. Then select whether to scan only your active plugins and themes or all extensions on your site.

update php version safely with php compatibility checker

Start the scan. When done, the plugin will present you with a list of errors and warnings for your site. It will even tell you the file name and line number where it encountered them.

From here, you can take action to replace faulty plugins or themes or find a different kind of solution (such as asking the developer to update their work). The plugin will also make suggestions.

By the way, if you have a plugin that is up to date but still flagged as incompatible, it might also be a false positive. WP Engine provides list of plugins known to be flagged for compatibility issues when there aren’t any. So, take that into account.

4. Upgrade PHP

Once made sure that your site is, by all accounts, able to handle the switch, it’s time to actually make it.

There are several ways of doing that. One is via SSH commands. However, if you know how to do this, you are probably not reading this article. Consequently, we won’t be going over it. However, if you still want to learn about upgrading your server’s PHP version via SSH, you can do so here.

We will go the easier way, which is to make the switch via the admin dashboard of your hosting provider. For example, in cPanel (which, by the way, is also based on PHP) it’s as easy as finding the menu item PHP Version Manager, navigating to your site’s location, picking the version you want to change to and hitting Save.

upgrade php version in cpanel
Source: SiteGround

If your host is running Plesk, you can find out how to upgrade PHP here. Unfortunately, for other admin panels, you will have to do your own search. Should you be unable to find any such option, your host might have disabled it. In that case, you need to get in touch with your provider.

5. Check Your Site

Once you have upgraded, the last thing to do is go back to your site’s front end and have a look around. Check every page to see if everything looks as it should and that parts of your site aren’t disabled or similar. Also, test the plugins you are using as well as theme features. However, if you have taken the precautions mentioned above, it’s very unlikely that there was a problem.

And that’s it. Congratulations! You just successfully upgraded PHP for your WordPress site.

Summing Up

PHP is the glue that holds WordPress together. For that reason, it’s important to keep it up to date. This will also allow you to profit from increased speed and security.

Above, you have learned about PHP and why it is important to upgrade. We have talked about how you can find out which version your site is running and how to prepare it for updating. Plus, we have told you how to implement said upgrade via your hosting management panel.

If you have followed along good job! Your site is now ready for the future.

Have you updated PHP for your WordPress site? Which version were you running before? Did you have any issues? Let us know in the comments section below!

Nick Schäferhoff is an entrepreneur, online marketer, and professional blogger from Germany. He found WordPress when he needed a website for his first business and instantly fell in love. When not building websites, creating content or helping his clients improve their online business, he can most often be found at the gym, the dojo or traveling the world with his wife. If you want to get in touch with him, you can do so via Twitter or through his website.

The post How to Easily Check and Update the PHP Version of Your WordPress Site appeared first on Torque.



Read Full Article Here

Leave a Reply