After over a decade without any major upgrades to the language, PHP 7 made its debut in December 2015. Since this upgrade brings so many significant changes after such a long time, the process of adapting to it can be intimidating.

However, there are quite a few reasons to switch over to PHP 7, particularly if you use WordPress. The minimum PHP requirements for WordPress core have increased, and many plugins and themes may soon become incompatible with older versions of PHP. Meanwhile, those past versions will not continue to receive security fixes forever, which could leave your site exposed to hackers.

As you can see, making the switch to PHP 7 is essential. At the same time, there are a few issues to watch out for during the process, such as non-compatible scripts. In this article, we’ll show you how to handle the upgrade to receive the best possible results!

New Features

PHP 7 drops many deprecated functions in favor of new, modernized features. These additional capabilities include anonymous classes, throwable errors, and type declarations. Updates such as these are a much-needed refresher, keeping PHP competitive as a programming language.

Overall, PHP 7 is faster, more secure, and significantly more resource efficient than older versions. To give you an example, a site running PHP 7 can handle twice as many visitors as PHP 5 can, using the same amount of memory.

Support for PHP 5.6

Each PHP branch goes through the same life cycle after its initial release – it receives support for two years, and bugs and security issues are actively fixed during this time. There’s then an additional year when only critical security updates are provided. These changes are released on an as-needed basis, depending on whether any security issues have been found and reported. Finally, three years after initial release, the branch is no longer supported in any way.

PHP 5.6 stopped receiving active support on January 19, 2017, and has now moved onto the critical security phase. These security updates will end on December 31, 2018:

PHP support expiration dates

This means there will be no more feature upgrades or fixes for PHP 5.6. Only the most serious security holes will receive upgrades, if they are found and properly reported by the PHP development community.

In other words, you’ll want to make the switch to PHP 7 right away order to reap the benefits of continued active development. If you’re only concerned about security, it’s still smart to upgrade within the next year, before PHP 5.6 becomes unsupported.

How to Upgrade to PHP 7

The simplest way to upgrade to PHP 7 is by asking your hosting company to update it for your account. Of course, this means you’ll need to be working with a hosting company that supports PHP 7 in the first place. Some companies make it easier to upgrade to PHP 7 than others.

Here is a sample script you can send to your hosting company:

Dear [host name],

I run WordPress on one of your servers, and WordPress.org lists PHP 7 as the recommended version of PHP on their requirements page (https://wordpress.org/about/requirements/).

Can you please let me know if my account supports PHP 7, and how can I upgrade?

If you administrate your own server, you can also perform the upgrade process yourself. However, proceed with caution! You should always ensure your existing site is compatible with the update before moving forward.

Should your hosting company decline your request, or if it turns out they don’t offer PHP 7 support, it may be time to seek out a new place to host your website. Here at WP Engine, we offer PHP 7 via a simple two-step process:

First, you should ensure that your site’s code is compatible with PHP 7.

Then send a request to our team, asking for the upgrade. We handle the rest!

By following these steps, our customers can benefit from PHP 7 while reducing the chance of something going wrong. In the next section, we’ll show you the open-source tools we offer, so you can check your site’s code for PHP 7 compatibility.

Checking Compatibility

Checking your code for PHP 7 compatibility means parsing through it to ensure any deprecated functions or changed features don’t disrupt the expected output. This can be a tedious process of trial and error but is much easier if you automate the code analysis aspect.

We wrote and open-sourced our own PHP Compatibility Checker as a WordPress plugin to help users all over the world safely make the switch:

php compatability checker plugin

To use the PHP Compatibility Checker, simply install it on your WordPress website like any other plugin, then follow the instructions to run a scan. The resulting report will help you identify any potential PHP 7 conflicts in your code, so you can have them fixed before upgrading.

Even if you don’t run WordPress, you can try out our front-end agnostic PHP 7 Compatibility Library. Remember, you don’t have to be a WP Engine customer to use these tools – we’ve made them freely available to everyone!

How Many Sites Are Already Using PHP 7?

PHP is used by over 82 percent of active websites today. Of all known sites using PHP, only 5.2 percent are running on version 7. Considering that PHP 7 has been available since December 2015, this means adoption of the update is moving slowly:

Different versions of PHP and their adoption

This is likely due to a general lack of knowledge about PHP and version updates. Not all website owners are also developers, and many are simply unaware of the available upgrades. Hosting companies can also be slow to update because they want to avoid dealing with potential code incompatibilities, despite the major advantages that come with making the switch. Industry giants such as Yoast are making a strong push to teach users about their options, and encourage more upgrades to PHP 7.

PHP 7 Performance

One of the clearest benefits of PHP 7 is its improved performance. At WP Engine, we’ve run a number of benchmark tests to see how well it stacks up against older versions of PHP, as well as HHVM:

How PHP 7 impacts speed

This graph measures the number of hits each site was able to handle within 300 seconds.

The results clearly show that PHP 7 is a significant improvement over older versions of PHP, enabling the language to hold its own against mighty competitors such as HHVM. With stats like these, updating your own website becomes a no-brainer!

If you’re with a managed WordPress host they should have options to easily upgrade your website’s to PHP 7.