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 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:
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!
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.
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.
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!