View Categories

How to Update Your WordPress Website to PHP 7

A snippet of PHP code.
  • Jun 13, 2017
  • 0
  • by A2 Marketing Team

Hypertext Preprocessor, or PHP is a widely used server-side scripting language that is at the forefront of web development. In fact, around 80% of websites – whose programming languages we know – use PHP. The problem is, most of them are still using deprecated versions even though PHP 7 has been around since 2015.

Imagine that most PCs were still running Windows XP and you’d have the right idea. Sure, it still works, but newer versions have far better performance and are more stable. The same goes for PHP. Its latest version offers a staggering improvement over past releases, and adopting it en masse could help propel the web forward.

In this article, we’ll tell you everything you need to know about PHP 7, including what its benefits are and how it compares to PHP 5. Then, we’ll teach you how to update your WordPress site to the latest version in three steps. Let’s get cracking!

An Introduction to PHP 7 (And Its Benefits)

PHP is a significant component of today’s web landscape. It helps power a large share of websites, applications, and even popular Content Management Systems (CMSs) like WordPress.

The PHP homepage.

The fact is, PHP 7 is a sharp improvement over past iterations. You don’t even need to be a developer to appreciate its impact or to benefit from what the language brings to the table. Let’s discuss why:

  • It has better performance. Thanks to its new engine, PHP 7 is almost twice as fast as its predecessor.
  • It gets more done with fewer resources. Increased speed means your site’s performance is less dependent on your server’s hardware, which can save you money.
  • It has new language features. If you’re a developer, you’ll appreciate that PHP 7 includes new functionality, such as return type declarations for functions.

If you’re a web hosting provider, then the benefits of PHP 7 should be self-evident. Not only will it enable you to provide a better experience for your users, but you’ll also save on server costs while doing so. The same goes if you’re an end user, so upgrading is a win-win situation.

Plus, it’s always a good idea to keep up with the latest software developments in your field. Similar to using an outdated Operating System (OS), running an old version of PHP leaves you open to security vulnerabilities.

WordPress offers an excellent example of why you should upgrade to the latest version of PHP. Since the CMS is primarily based on said language, it can really benefit from the added performance of PHP 7. If you’re ready to update your WordPress site, we’ll show you how in the next section.

How to Update Your WordPress Site to PHP 7 (In 3 Steps)

When it comes to updating to PHP 7, one of the major issues is many web hosts still don’t support it, or won’t let you update to it if you’re using a shared plan. So you have two options – either upgrade your plan to something more customizable, such as a Virtual Private Server (VPS) or a dedicated one, or switch hosts.

In most cases, the second option will save you money, so that’s what we’ll teach you how to do. We’ll tell you how to prepare for the switch and execute it, in three simple steps.

Step #1: Check Your WordPress Site for Compatibility Errors

Before updating to PHP 7,  the smart move is to check whether any of your WordPress site’s components are incompatible with it. There are a few ways to go about this. The first is a simple plugin option, but this may not give accurate results every time.

The approach we recommend involves setting up a local environment. This way, you make a copy of your site and test it’s compatibility with PHP 7 without affecting your live website. There are many ways to set up a local WordPress site, but we’re big fans of using MAMP (which is available on both Windows and macOS):

The MAMP homepage.

Once you’ve installed it, these are the steps you need to follow to test your site on a local environment:

  1. Create a full backup of your site using a plugin such as UpdrafPlus.
  2. Set up a local WordPress site using MAMP and PHP 7, which is set as the default option for any sites you create with the service.
  3. Install UpdraftPlus on your local website.
  4. Restore the backup of your site to your local environment using UpdraftPlus.
  5. Check your website for compatibility issues.

This is the most thorough way you can go about testing whether your site is ready for PHP 7. Plus, having a local testing environment ready can come in handy the next time you want to make a major update to your site.

It’s worth noting that if you’re an A2 Hosting user, you can use our PHP Switcher feature to test your site with PHP 7 in a matter of minutes. Keep in mind this will affect your live website, though, so you’ll probably want to test it during off hours just in case.

Step #2: Fix Any Errors on Your Site

If you didn’t find any issues with your site’s plugins and themes, then you can skip this step. Otherwise, you have two options available – the first is to update the offending elements in case they have new versions available. Then, test it again and see if they still display the same errors.

Now, if there aren’t any updates available, you’ll need to think about replacing the problem theme or plugins with alternatives. That way, you still get to enjoy similar functionality and the benefits of PHP 7.

One place to start looking for options is in the official WordPress.org repository:

The WordPress plugins repository.

Unless you’re using a highly specific plugin, chances are you’ll find a similar one there. As for themes, Themeforest offers some of the best premium options around, and a quick Google search can help you find great alternatives for specific niches.

Step #3: Move Your Site to a Web Host that Supports PHP 7

Now that your site is free of any incompatibilities with PHP 7, it’s time to make the leap and upgrade to it. In this case, that means moving to a web host that already implements the latest version of the language with its plans (which we do).

Our PHP 7 plans page.

Moving a WordPress website to a new host might sound like a tall order, but it doesn’t have to be. If you need help, most reputable web hosts offer free migrations for new customers. In our case, we can help you get your site moved quickly, especially if your former host used the cPanel platform.

On the other hand, you can always migrate your site manually if you don’t mind following a few steps. The process may take a little while, but the rewards should be evident once you get to test drive how WordPress feels running on PHP 7.

Conclusion

PHP 7 isn’t merely a step forward from PHP 5 – it’s a giant leap in terms of performance and usability. If your site is among the 80% or so that use PHP to power their applications, you might be shortchanging yourself by not upgrading.

If you’re a WordPress user, you’re in luck. All it takes is three steps to adopt PHP 7 if your current host doesn’t already support it:

  1. Check your WordPress site for compatibility errors.
  2. Fix any errors on your website.
  3. Move your site to a new web host that supports PHP 7.

Image credit: Pixabay.

The A2 Posting