Though it’s the most widely used web programming language, PHP has taken a lot of flack in development circles. However, after a long period with no major updates, PHP 7 has finally been released with many great new features – and it will also help you keep your WordPress website in tip-top shape.

Simply put, PHP is at the heart of the WordPress core, and to get the best possible performance for your site, you should always use the latest version. However, while some hosts are being proactive, you may need to give your particular host a nudge if they’re dragging their feet with regard to updating PHP on your server.

In this article, we will first introduce you to PHP and it’s most recent update, then offer three compelling reasons for why it’s worth upgrading. Finally, we’ll show you how to get up to date. Let’s get started!

An Introduction to PHP and the PHP 7 Update

As you may be aware, PHP is best known as a server-side scripting language for the web, although it began as the personal creation of Rasmus Lerdorf in 1994. Due to its ease-of-use, it grew into a language with a low barrier of entry, enabling both experienced and green programmers to use it. As a result, it’s now used for over 80% of the web – including WordPress:

Server Side Script Languages

Even so, PHP went for twelve years without receiving a major version update. That’s a long time in the ‘real world’, but in internet time it’s practically prehistoric. After a few version updates to PHP 5 (along with a failed attempt at building PHP 6), PHP 7 became the new release candidate in 2014.

Although we’re just beginning to discuss its merits now, PHP 7 has actually been available since 2015. It means leaving PHP 5 behind for the good of the development community and the performance of your website should be your current goal.

3 Compelling Reasons You Should Make the Switch to PHP 7 for WordPress

Now you’re up to speed with why PHP 7 is so significant, it’s time to discuss three major reasons you should upgrade. By the time we’re finished, you should have a clear understanding as to how PHP 7 will benefit your WordPress website.

Reason 1: WordPress Advocates for PHP 7

In a nutshell, we believe that keeping your software up to date is a good idea for a myriad of reasons – we’ve previously talked about those in-depth while showing you how to upgrade WordPress. WordPress stands behind this, too. Updates are (of course) necessary for security reasons, to fix bugs, and to add new features and functionality, so it makes sense to apply these same standards to your WordPress server too.

Official WordPress.org server requirements
The official WordPress site recommends PHP 7.

Leading up to PHP 7’s official release in 2015, the WordPress core developers slaved away to practically guarantee compatibility in advance. What’s more, Aaron Jorbin published a statement at Make WordPress stating:

WordPress continues to encourage all users to run the latest and greatest versions of PHP, including PHP 7 upon its release.

It means WordPress’ core has been ready for PHP 7 since its release in December 2015.

However, although core has been ready for a while, the same might not be said of any plugins and themes. Because they’re essentially third-party additions to core, there’s less control over their compatibility. It means that you should ensure any third-party code, plugins, and themes you use are also PHP 7 compatible before upgrading to avoid nasty surprises. To help, you could use WP Engine’s PHP 7 Compatibility Checker plugin, which does what it says on the tin:

The PHP Compatibility plugin

Once you run the test with the plugin, there are three options for handling errors on the compatibility report:

  1. Resolve them by fixing the code yourself (which could mean adopting the plugin).
  2. Reach out to the developers to make sure it gets fixed.
  3. Replace them with plugins that are already PHP 7 compatible (which is as simple as running them through the plugin again).

Once you’ve cut any non-PHP 7 compliant plugins and themes, you should be ready to upgrade!

Reason 2: PHP 7 Offers Better Development Features

PHP has always been known for its ease of entry, which is one reason why it’s a popular language for many new web developers. Unfortunately, this can lead to poorly written code full of security holes and performance issues.

To help combat this, many aspects of PHP 7 attempt to steer new developers in the right direction. It does this by removing poorly written, outdated functions previously kept in for backwards compatibility reasons. With the adoption of PHP 7, we should begin to see a higher standard of PHP coding. In turn, this should also help PHP become more respected as a development language, attracting talent that has otherwise avoided it.

Spaceship operator in PHP 7
The spaceship operator is a new function available in PHP 7.

Here are a few of the new features introduced in PHP 7, and why they’re so interesting:

Of course, this is an incomplete list of features. However, these are just some of the more exciting inclusions in PHP 7.

Reason 3: PHP 7 Is Blazingly Fast and More Secure

Another reason PHP 7 removed so many old, deprecated functions was to make room for the new features we previously discussed. This cleared up a lot of space, which enabled PHP 7 to grow without bloating in size. As such, PHP 7 is a much leaner and more efficient language. What’s more, it also ships with the new Zend engine, which offers much faster processing.

To order to ascertain exactly how fast PHP 7 is compared to its previous versions, we ran some speed benchmarks. As you can see, PHP 7 blows other versions out of the water:

PHP7 speed test

At a base level, speed will help your WordPress site in two major ways: usability and Search Engine Optimization (SEO).

Site speed directly impacts responsiveness, which makes it feel fun to use. What’s more, good usability keeps visitors on your site longer, and can potentially improve your conversion rates. Site speed is also a ranking factor for search engines, and a high ranking website stands to earn greater traffic.

As for security, we’ve already discussed how PHP 7 makes it harder to write poor code by default. Additionally, there are also a few new tools for serialization and cryptographically secure random numbers. It means that even if you never write a line of PHP code, the developers who do can put out better work thanks to PHP 7. Of course, to benefit accordingly, it needs to be running on your server.

Finally, previous versions of PHP have been around for so long that there are many well-documented hacks for each. (You can learn more about server security at the WordPress Codex.) As PHP 7 is newer, there are likely fewer known ways to exploit a PHP 7 specific weakness. This also ties in with our advice about keeping WordPress up to date, as each release often comes with security fixes.

How to Upgrade to PHP 7

If you administrate your own server, you can upgrade to PHP 7 yourself (although you’ll want to carry out a common sense check first). Otherwise, we recommend reaching out to your hosting provider to ask for a PHP upgrade. Here’s a sample email you can send them, adapted from a WooCommerce template:

Dear host,

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 they won’t comply, it’s probably time to find a host that supports PHP 7. We’ve also written extensively on PHP 7-related topics over the past couple of years, and given its adoption, we plan on continuing to do so in the future!

Conclusion

PHP 7 comes with a lot of improvements over its predecessors that will directly benefit your WordPress website. Regardless, it’s sharply becoming a non-conditional requirement for running a secure and speedy WordPress website, so it’s important to make the switch sooner rather than later.

In this piece, we’ve offered three compelling reasons to upgrade to PHP 7. Let’s quickly recap them:

  1. WordPress.org encourages users to always use the latest version of PHP for improved security and performance.
  2. PHP 7 enforces better coding standards, improving coding standards across the board.
  3. The latest PHP version can run significantly faster than its predecessors, which will improve your site’s speed as well.

What questions do you have about making the switch to PHP 7? Let us know in the comments section below!

Image credits: Courtney Recker.

John Hughes

John is a blogging addict, WordPress fanatic, and a staff writer for WordCandy.

The post 3 Compelling Reasons You Should Make the Switch to PHP 7 for WordPress appeared first on Torque.

Share This