php-7-large

How to upgrade your WordPress site to PHP 7 (and why you should!)

Morgan Smith's Layout avatar

If you’re a WordPress site owner, PHP 7 is likely on your radar. (And if it isn’t yet, it should be!) PHP alone is an incredibly important part of all WordPress sites – it’s basically what makes them work. PHP 7, however, is an amazing advancement for this already powerful language that can provide your site with a ton of performance perks.

If your site isn’t on PHP 7 yet, I highly recommend upgrading it. This guide will teach you why PHP is important, give you an overview of some awesome PHP 7 features, then help you prepare your site for the switch. Let’s dive in!

What is PHP?

In it’s simplest form, PHP is a programming language that helps create websites. Any website can use PHP, but WordPress was actually built with it, meaning every single WordPress site uses it. It’s also open-source (just like WordPress), which made them a natural fit.

php-7-wordpress

PHP is a server-side language, so it mostly comes into play when loading web pages – it’s the language the browser uses to communicate to the server so it knows what assets to load on the page. Nifty, right?

To see PHP in action, look for files in your database that end in .php. You’ll also see code snippets that look something like this:

<?php

echo “Hey, I’m PHP code!”;

?>

PHP is a core part of what makes all WordPress sites work, and because of that, staying up to date with the best version is essential for having a high-performing site that loads quickly. The recommended minimum version is PHP 5.6, but PHP 7.1 has some incredible benefits for your site.

PHP 7 features

1. It’s crazy fast!

One of the most notable differences with PHP 7.1 is that it’s incredibly fast, especially compared to older versions of PHP. Like any new technology, the developers really focused on minimizing resources and increasing efficiency, which resulted in a lightning-fast solution that’s commonly being benchmarked at twice as fast at PHP 5.6. That’s a serious speed improvement that you should definitely take advantage of!

php-7-work

2. More control over type declarations

PHP doesn’t require you to declare variable types – it does this automatically (which can make for quick coding) but can also result in some errors, because it doesn’t always catch if you’re mixing things up. With PHP 7, you can override the assumptions and declare your own variable with some super useful new techniques, giving you more control and cleaner code. If you’re interested, you can read about the specifics here.

3. Better error handling

In the past, if PHP encountered an error, it would just kind of…stop. It wouldn’t trigger the error handler, resulting in the dreaded white screen of doom. (Which no credible site owner ever wants to see.) PHP 7 isn’t a full solution to this, but it does allow you to write error exceptions, which can help catch some of those problems before the script decides to just shut down.

Sounds pretty darn fantastic, right? And that’s not even all of the updates; you can read about the rest here. Now here’s the icing on the cake: Once you’re ready to upgrade to PHP 7, it’s not too difficult to do (especially if you’re site is hosted on Flywheel)!

How to upgrade to PHP 7

The best part about upgrading to PHP 7 with WordPress is that you really don’t have to do too much – in general, that process falls on your hosting provider. To ensure a smooth upgrade, however, there’s one incredibly step that every site owner should do – upgrade your themes and plugins.

php-7-update

Most new versions of themes and plugins should be compatible with PHP 7, but if you’re running older versions, they might not be (and that’s when things get scary). If you’re not sure how everything will work once you upgrade, we recommend testing your site in a local WordPress environment where you can “upgrade” the PHP version yourself and safely see what happens.

Local by Flywheel is a free local WordPress development app that makes it a breeze to safely test updates and develop sites locally. Download it today!

Once you’ve updated your themes and plugins and are confident about switching to PHP 7, you’re ready to start the actual upgrade process. (This is the part that generally falls on your hosting provider.) Some provide settings in the dashboard while others ask that you contact their support team to start the upgrade process.

It’s not too difficult, but here at Flywheel, we wanted to take that one step further to make things super slick and super easy for anyone hosting sites with us. That’s why we’re so excited to offer PHP 7.1 as the default for all new sites on Flywheel!

If you’re a current customer, you don’t have to do a single thing – we’ll start automatically upgrading sites to PHP 7.1 over the next few months. But of course, if you’re so excited and you just can’t hide it, just let our support team know and we’ll upgrade it right away!

If you’re not a Flywheel customer yet but like the way this sounds, give us a test run – you can spin up a free, PHP 7.1-ready demo site or even submit a migration request. (We migrate your sites to Flywheel for free, too!)

No matter where your site is hosted, we highly recommend updating to PHP 7. It’s full of performance and security improvements, and it’s incredibly supported. There’s really no reason not to upgrade!

Comments ( 5 )

  1. Brin Wilson

    June 22, 2017

    Great news! But instead of having to make a support request, can we have a button somewhere in the dashboard to choose the PHP version please? So we can change to PHP7 and then, should we wish to (if there are any issues etc, etc), change back again with ease?

    • Morgan Smith

      June 22, 2017

      Hey Brin, thanks for the feedback! I'll pass this onto our product team for consideration :)

  2. Mike Allen

    June 29, 2017

    I agree with Brin. There are some hosts that have that option now and it's great. Would like to see it here at Flywheel. Thanks for this article too, Morgan!

  3. Dave Bonynge

    July 13, 2017

    If we upgrade to 7.1 - does that affect all our Flywheel sites, or can we upgrade on a site by site basis? We are on a "Freelance Bulk" account and use our account to set up clone test sites.

    • Morgan Smith

      July 14, 2017

      Hey Dave, the upgrade will affect all the sites in your bulk plan. One option for running different PHP versions on test sites would be Local by Flywheel, our free local development app. It's a super easy way to experiment with different settings and see how everything behaves. You can download it here if you're interested!

  4. Michael McCall

    July 14, 2017

    I'm most excited about the error handling! I assume it doesn't come out of the box, it sounds like you're saying we'd need to write in the handlers ourselves. Is there any articles you'd recommend to understand this better for common WordPress issues? Or maybe a plugin that handles them for us? Thanks!

  5. harsh sharma

    January 9, 2018

    Very Good Article...

Join the discussion