Upgrading PHP

Does your website seem to run slower than usual? Are you worried you’re losing customers because of page speed? Is Google lowering your search-result ranking? It’s possible your server software is outdated.

Your website might not be operating at its full potential. There’s an important issue that might be affecting your site’s performance — and that you can resolve if you follow the instructions on this page. Let’s talk about what PHP is, and why you might need to update it.

What is PHP? What is PHP?

PHP is the foundational coding technology of WordPress. Just like any underlying structure, it’s important to keep it strong and secure. When you use an old version of PHP on your WordPress host, you’re building a WordPress site on weak bedrock. If you’d like to ensure your site is secure, fast, and compatible with all parts of WordPress, upgrading to the latest version of PHP is crucial for a number of important reasons.

WordPress uses the latest version of PHP (linked to requirements page). Although WordPress’s commitment to backward compatibility allows you to use versions as old as PHP 5.2, that version was originally released in 2007. It’s so old, even people who work on PHP don’t maintain it anymore. Why would you want your website to run on ancient software?

Top ↑

Why PHP Should Matter to You as a Site Owner Why PHP Should Matter to You as a Site Owner

There are three things site owners usually care about the most. First, they want their website to work as expected when people visit it — we often call this site availability. Second, another major concern is how fast the site loads and functions, or site performance. Finally, you likely want your site to make use of all the latest and greatest tools, or features. Let’s go through these three aspects in greater detail.

Site Availability Site Availability

Each of us has clicked on an ad or a link that led us to a 404 error or to the dreaded “white screen of death.” There are many reasons that this could happen: unplugged servers, internet connection issues, or human error in configuration, for example. One of the least pleasant reasons a site could go down is because of hacking. WordPress is a safe and secure platform for your business — as long as you keep everything on your site up to date. Unfortunately, bad actors on the internet will figure out ways to explit any code, and then hack sites using that code. Since PHP is running a very large percentage of the web, and WordPress is built on PHP, these malicious people tend to focus their efforts on this underlying code. Once a vulnerability is publicly known, hackers use that same opening to attack more sites.

Fortunately for all of us, the vibrant PHP community is constantly improving PHP. But community members can only properly support the latest versions of the language. Older versions are not supported at all. Keeping your PHP version up to date ensures your website is ready for business, before your customers land on it. And the code is freely available, so make sure to use the latest version to keep your site safe.

Top ↑

Performance Performance

Your site needs to load fast enough to offer an enjoyable experience to your visitors. “73% of mobile internet users say that they’ve encountered a website that was too slow to load,” says Kissmetric’s research. They also report that “40% of people abandon a website that takes more than 3 seconds to load.” Performance is also a key factor in determining your site’s position in Google search results.

Just like any other complex machine, the performance of a site depends on the quality of the parts it’s using, which have to be of good quality as well as well-tuned. PHP is a major part of how sites are delivered to visitors, and one of the ways WordPress sites can improve performance without a lot of effort is to update PHP to the latest supported version — currently PHP 7.2. Sites can see a 30% increase in performance (or more) just by making this change.

Top ↑

Features Features

Let’s compare buying a new car in 1978 to doing the same today. These days, you would expect the car to come with a stereo system, heated seats, active braking assistance, and a rearview camera. The car from 1978 would have none of those things. This doesn’t mean that it was a bad car; rather, the world of automobiles continued to progress and those features did not exist back then.

WordPress has evolved much faster than automobiles and there are more new features available today than ever before. The newest features are only available in the latest version of PHP, so fewer features will be available to you if you don’t keep up with the latest release. Make sure you can use the latest and greatest functionality for your WordPress website by updating to PHP 7.2.

Top ↑

Are there risks when upgrading my PHP version? Are there risks when upgrading my PHP version?

In a perfect world, the answer would be “No.” However, the WordPress ecosystem is made up of thousands of themes and plugins (built and maintained by developers all over the world). All the various combinations of these parts that can be added to your site increase the potential for incompatibilities with certain PHP versions. WordPress cannot detect all those possible conflicts automatically.

WordPress as a content management system (CMS) is committed to backward compatibility. This means the main files that run your site will work as far back as PHP version 5.2. That said, we recommend version 7.2 for all the reasons we listed above.

“At Yoast we care about a lot of things, but two things in a very particular order: user happiness first, developer happiness second. A user is happy when he or she has a fast, easy to install, secure content management system like WordPress to build a site in. A developer is happy when he or she can use a modern language and modern tooling to build software with.” – Joost de Valk – Whipping your hosting into shape

Top ↑

Before Upgrading PHP Before Upgrading PHP

Top ↑

Backup and Rollback Plan Backup and Rollback Plan

Before upgrading or making any major change, you should create a backup of your site. This way you can easily restore your site should something go wrong. If you do not already have a backup solution in place, we recommend using a free plugin.

While we are encouraging you to upgrade your version of PHP, it’s important to keep in mind that a standard WordPress backup only includes your site’s database, media files, and code. The PHP version is set on the server level (by your website host) and is not included in the backup. In other words, it would not automatically restore if you do need to restore. If upgrading to a higher PHP version causes issues, you will need to ask your host to move you back to the previous version of PHP.

Top ↑

Standard WordPress Updates Standard WordPress Updates

Make sure all parts of your WordPress installation are up to date. Update WordPress core and all of the plugins and themes that you are using. It is considered a best practice to update plugins and themes one at a time. This allows you to prepare yourself for any unexpected issue as you’ll be able to pinpoint the plugin or theme causing a problem.

After you have successfully completed all of the available updates, it is useful to create and store a new backup in addition to the one from the first step, if your tooling allows for this. Most tools will let you create multiple backups that are either stored in the site’s file system or that you can download to your preferred storage solution, like local computer or Dropbox. This gives you a convenient rollback option to an intermediate step, so that you don’t have to go through all updates again in case of a failure.

Top ↑

PHP Compatibility Checker PHP Compatibility Checker

One of the tools that can help you determine whether or not a plugin is compatible with PHP 7.2 is the PHP Compatibility Checker plugin, which you can install and activate on your site. This tool can scan all plugins and themes for possible issues with modern PHP versions. After scanning your site, the plugin will recommend to you which PHP version to upgrade to, and will highlight any potential issues. As with all plugins, make sure to review the documentation (instructions). Also, as with any automated test, be aware that false positives are possible.

Top ↑

Replace Incompatible Plugins Replace Incompatible Plugins

If you find one or more of your site’s plugins or theme do have compatibility issues with the newer PHP versions, your options depend on how severe the issues are. Many incompatibilities can be fixed by a developer, sometimes requiring quick and simple changes. If you already work with a developer, ask them about this option. Otherwise, if a plugin or theme poses significant issues, you may need to find a replacement for it. You can find multiple plugins and themes with similar functionality that are compatible with the latest versions of WordPress in the WordPress plugin repository.

Top ↑

Need Help? Need Help?

Though these steps are straightforward and require just a little patience and persistence to implement, we realize that sometimes people can use a little more help than just what the documentation provides. If you wish to find help with your PHP upgrade, these are your best options:

  • A professional web developer. If you have an existing relationship with a developer or agency, you may want to also consult with them regarding your site’s specific needs.
  • Your hosting company. If you are on a host specializing in managed WordPress solutions, they likely offer help with this process; we encourage you to ask.
  • Plugin and theme authors. Don’t hesitate to contact plugin and theme developers to request information about compatibility with a newer PHP version. Most of the time, you can find their preferred support channel by looking at the plugin or theme itself in the admin screens. Most free plugins and themes are supported through the official WordPress community support forums. For premium plugins or themes, consult their terms of service and their documentation.

Top ↑

How to Upgrade PHP for your Website How to Upgrade PHP for your Website

While it would be stellar if WordPress could solve all PHP issues, that isn’t possible. PHP is part of the language on your website’s server, and WordPress does not control the PHP version there. It is up to you and your hosting provider.

So how do you do it? Our favorite answer: it depends on how you are running your site.

The good news is that many hosting providers will allow you to choose which version of PHP you can run. There are a lot of different companies with a lot of different ways to manage this. Fortunately, the WordPress community has collected some of the more popular providers’ upgrade paths.
If you can’t find instructions for your specific host, the best thing you can do is ask them. Here is a template you can use when emailing your provider:

Dear Hosting Provider,

I want my website to be as performant and secure as possible with the latest version of PHP. For the server my WordPress site is hosted on, I want to ensure that is the case. If I am not already on the latest version of PHP, please let me know what steps I need to take to upgrade.

Top ↑

Conclusion Conclusion

If your server isn’t on the latest version of PHP, your website isn’t operating at its full potential. Keeping foundational server-side software up to date is a great way to not only help your own website’s performance but to help keep the internet, as a whole, more secure. Upgrade to PHP 7.2 today.