Safe WP Upgrade to PHP7

I collect content without permission for WP Struggles*. Please visit the original sites, especially to share and comment.

I tried to upgrade to PHP 7 thru cPanel and crashed my site.  So I need this info.  There are other useful tools in this article as well.

UPGRADE WORDPRESS TO PHP 7: HOW TO DO IT SAFELY

CATEGORIESFEATUREDWORDPRESS TOOLS

Upgrade WordPress to PHP 7

PHP 7 offers one of the biggest jumps in performance we’ve seen so far from this particular software. If your web server is still running a previous version, you may be holding your site back from working as well as it could. The only problem is that learning how to upgrade WordPress to PHP 7 can be a little tricky.

Despite that, upgrading your site to the latest version of PHP is a smart move, and one that will benefit you in a number of ways. Plus, the process isn’t actually that difficult as long as you go about it safely, to ensure that the update won’t break any of your site’s elements. That way, you won’t have to rush around fixing things afterward.

In this article, we’re going to talk about what PHP 7 is and why you should make the switch. Then we’ll teach you how to upgrade WordPress to PHP 7 safely, in just four steps. Let’s get to it!

Here’s how to safely upgrade #WordPress to PHP 7CLICK TO TWEET

HOW PHP 7 CAN BENEFIT YOUR SITE

In a lot of cases, people put off upgrading to the latest versions of the software they use because they don’t know a new version is available, or they don’t realize how much of an improvement it is. That’s why so many users still aren’t running PHP 7, despite its tangible benefits.

PHP 7 offers some massive upgrades for end users. For example:

  • You should see about a 50% performance increase after making the switch. PHP 7 offers a huge performance boost that’s well worth the upgrade.
  • It supports 64-bit Windows systems. Most people use Linux for their servers, but if you’re a Windows user, you’ll appreciate the new support for 64-bit operating systems.

Plus, PHP 7 is now the official recommended PHP version for WordPress.

If your primary concern is that installing PHP 7 will break your site in some way, then we’ve got your back. There’s always some risk involved in an upgrade like this, but there are also ways to carry out the process safely.

HOW TO SAFELY UPGRADE WORDPRESS TO PHP 7 (IN FOUR STEPS)

Before we go any further, let’s talk about how the upgrading process works. If you have full privileges on your server, you can upgrade WordPress to PHP 7 using your command line. On the other hand, if you’re on shared or managed hosting, you’ll probably have to ask your provider’s support team to upgrade your site manually.

In either case, the actual process is straightforward. The problem is that if you don’t take any precautionary measures, you run the risk of breaking elements of your sitethat don’t play nicely with PHP 7. That’s why we’re partial to a different approach that enables you to eliminate most of the risk involved.

STEP #1: BACK UP YOUR WEBSITE

Backing up your site regularly is something you probably already do. However, you’ll want to have a backup of your site that’s as recent as possible.

You’ll be using this backup to create a copy of your site, where you can test how everything works with PHP 7 without causing any damage to your live site. If a plugin ceases to work, for example, you’ll know you have to look for an alternative before you upgrade your real WordPress site to PHP 7.

For this step, we recommend using the UpdraftPlus plugin, since it’s one of the most straightforward backup solutions available. Install and activate it now, and then go to the Settings → UpdraftPlus Backups tab:

Backing up your website.

Once you’re in, click on the Backup Now button, and choose to include both your database and files in your backup:

Including your database files in your backup.

Give the plugin a couple of minutes to back up your site, or possibly more (depending on how large your site is). When it’s done, you’ll find your new backup files under the Existing Backups tab:

Your new backup files.

Now, you’ll want to click on the following four buttons in turn: DatabasePluginsThemes, and Uploads. This will give you the option to download copies of each file to your computer:

Downloading copies of your backup files.

When you’re done, you should have four files containing your entire website. Now you’re ready for the next step.

STEP #2: CREATE A LOCAL STAGING COPY OF YOUR SITE

There are plenty of ways to create a staging copy of your website, but we’re partial to Local by Flywheel because it’s easy to set up. Plus, you don’t need to be a Flywheelcustomer to get the app. Just go to the website, fill out a short form, and download the tool.

After installing Local by Flywheel, you’ll be able to add new local websites to your roster by clicking on the plus sign in the lower left-hand corner of the application:

Adding a new website to Local by Flywheel.

Do so now, and you’ll be prompted to choose a name and an environment for your staging site. When you get to the environment part, select the Custom option:

Customizing your local website's environment.

This will give you the choice of using PHP 7 for your staging website instead of 5, which is the default setting. Make sure you choose the right version, and then create an admin name and password for your site. After that, sit back while the app sets everything up.

Once your new staging website is ready, look for it under the list of local sites on Local by Flywheel’s main screen. Then click on the Admin button that will show up next to its description, to access your dashboard:

Local by Flywheel dashboard

(Note; if you need some hands-on guidance on how to use Local by Flywheel, we’ve got a whole tutorial on that. Check it out.)

The first thing you’ll want to do here is install the UpdraftPlus plugin once more. When it’s running on your staging site, return to the Settings → UpdraftPlus Backups tab and look for the option that reads Upload backup files:

Uploading your backup files before you upgrade WordPress to PHP 7

Now, drop the four backup files you downloaded earlier into the designated area. When the upload is complete, you’ll see your backup appear on the list. Click the Restore button next to it, and you’re in business.

STEP #3: TEST YOUR STAGING SITE

What you’ve just done is created a staging website that’s a perfect copy of your original site in every way, except for the fact that this one is running PHP 7.

Now comes the part where you look for errors on your staging site. What you’re looking for and what issues you might find will vary widely depending on your unique setup. However, here’s how we recommend you go about conducting your test:

  1. Make your way through every page on your website, looking for any elements that have suddenly stopped working.
  2. Check to see if your plugins are behaving as they should, one by one.
  3. Test any features that your active theme includes, to ensure that they’re still functioning.

This might take a little time, depending on how large your website is. If you run into any broken plugins or themes, it’s worth looking for replacements, since PHP 7’s benefits are well worth making a few changes.

STEP #4: UPGRADE YOUR LIVE SITE TO PHP 7

If you didn’t find any errors on your staging website (or after you’ve identified the source of any problems that do appear), all that’s left is to upgrade your live site to PHP 7. As we mentioned earlier, this process is rather simple. There are two ways to approach it, depending on your host:

  1. If you use a Virtual Private Server (VPS) or any other hosting option that gives you full control, you can upgrade WordPress to PHP 7 from the command line.
  2. If your host doesn’t give you this level of access, you can ask them to upgrade you to the latest version through their support system.

When you’re done, be sure to test your site’s performance again (just to be safe). Then you can start enjoying the improvements PHP 7 provides!

CONCLUSION

PHP 7 has been around for a while now, yet adoption rates are nowhere near where they should be. This new version offers a marked increase in performance, and most reputable web hosts will give you the option to upgrade WordPress to PHP 7. If yours doesn’t, then it’s probably time to choose a new WordPress host.

Here’s a guide to safely upgrade #WordPress to PHP 7CLICK TO TWEETHere’s a quick cheat sheet on how to upgrade WordPress to PHP 7 without breaking your site in the process:

  1. Back up your website.
  2. Create a local staging copy of your site.
  3. Test your staging site to ensure that everything is working as it should.
  4. Upgrade your live site to PHP 7, and test it again.

SaveSave

*My WP sites serve as my reference collections and notes for everything I do or have interest in for my use only.  I use copied content on this MultiSite network toni-two.com and my ESL MultiSite at toni-esl.com.