...

How To Update PHP To The Suggested WordPress Version

how-to-update-php-to-the-suggested-wordpress-version

Using an outdated version of WordPress core, plugins, or themes puts your site at risk. PHP is no different.

While WordPress technically works with some older versions of PHP, you’re sacrificing performance and compatibility, while opening yourself up to security vulnerabilities by using these.

For safety and stability, always aim to use the WordPress recommended versions of PHP.

In this post, we’ll talk about how to check what version of PHP you are running, how to update your PHP to the recommended version for WordPress, and how a capable hosting provider can take care of these elements for you.

Jump Links for this Article:

  • Respect for PHP
    • WordPress Recommendations
  • Why You Need to Update PHP
    • Speed
    • Expense
    • Vulnerabilities
  • An Aversion to Versions?
  • How to Update PHP in WordPress
    • Step 1: Create a Copy of Your Site
    • Step 2: Create a Local or Staging Site
  • PHP QC
    • Handy Tools
    • Fixing Issues
    • Resources
  • PHP Host Partnering

the current recommended PHP version for WordPress is 7.4 or greater.

Quality hosting providers will generally require you to use the WP recommended version of PHP in order to use their servers, and will help you modify your site to ensure that the latest version of PHP will not break it.

For example, we’ll refer to ourselves (hey, we’re proud of our hosting!). WPMU DEV Hosting provides your site(s) with the latest sanctioned PHP versions.

Upgrading (or downgrading) to various versions is a simple process, done through our Hub 2.0.

Occasionally, some third party plugins may be out of date and cause issues with the latest version of PHP.

In that case you can look for updates, alternatives, or if necessary, downgrade your PHP version to an older one (as long as it’s still actively supported with security patch releases).

Click here if you’re interested in our full documentation on PHP through managed hosting in WPMU DEV.

PHP Versions WP Pie chart
Puny Helping (of) Pie — A miniscule 0.7% of sites use the most recent version of PHP, while a minimal 36.6% use the recommended version of PHP.

Less reputable, cheap hosts will not take the initiative to encourage you to upgrade your PHP because of the additional cost of support time and resources to help you transition.

Since they don’t want to break your site by updating to newer, recommended versions of PHP, they’ll often leave your site to use outdated versions of PHP and hope it goes unnoticed.

PHP 7.2 made its debut in November 2017. Considering the three year rule, we know it reached its End of Life cycle in November 2020 (as well as the even older PHP versions prior).

This means more than one-third (37.2%) of WordPress sites are currently running versions of PHP that are no longer actively supported.

That’s not the worst of it. Historically, there have been extended periods of time where that number has hovered at and even exceeded two-thirds (66%)! This is problematic for several reasons.

speed tests conducted by Kinsta, across 7 versions of PHP, consider the following stats:
Benchmark results PHP versions (Kinsta)
PHP versions show demonstrable speed differences.

You can see from the above table that with each newer version of PHP, the requests per second get incrementally faster.

Since using the recommended version of PHP takes less time to serve the same number of requests, you can give your visitors a much better user experience.

Kinsta also tested on PHP version 8, and I did want to note the scores for it, as the improvements in speed really continue to trend upwards.

With a benchmark result of 233.40 requests per second, PHP 8.0 takes a giant leap over PHP 7.4, proving to be 18.5% faster.

Step back a few more versions to 7.0, and it actually handles 50% more requests per second, comparatively.

I didn’t include PHP version 8.0 in my chart, because its support in the general WordPress purlieu is very difficult to assess. (WordPress 5.6 is presently considered beta compatible with PHP 8.0.)

Knowing this, please proceed with caution and do thorough testing before upgrading any crucial or client sites to PHP 8.0.

CVE Details, there were only 2 known vulnerabilities found in PHP in 2021 YTD.

Compare this to the 14 vulnerabilities discovered in 2020, the 23 noted in 2018, and the 105 found in 2016, and you can see why updating can help protect you from many known security exploits.

CVE vulnerabilities in PHP versions.
Number of vulnerabilities per PHP in a given year.

It’s a matter of fact that some hackers look to see what version of PHP you’re running to determine what kind of attack would be effective.

SFTP for your files and exporting a copy of your database using MyPHP.

In some instances, you may be able to use your last backup, if your backups include both the files and the database.

You could lessen the load by using a plugin made specifically for this task. Duplicator is a free plugin offered on WP.org that has positive reviews.

If you want the most streamlined, painless process for duplicating your site, and you’re already using WPMU DEV as your hosting provider, it’s your lucky day!! Cloning is already a part of your membership!

With a few simple points and clicks through our Hub 2.0, you’ll have fully configured, deployment ready WP Sites in mere minutes.

Not already hosting with us but want to get on the bandwagon?! No problem, just click here.

For more details, see our documentation on cloning sites through WPMU DEV hosting.

how to set up XAMPP on your local computer if you need help setting up your local environment.

Once your testing environment is set up, you can add the files and database from the previous step to your testing environment, so you have an exact replica of your live site.

After you have a copy of your site in your testing environment set up, you’re ready to upgrade the PHP version of your testing site.

*Hosting through WPMU DEV includes the ability to create a staging environment, and it is a breeze to do. Click here for details.

Error Log Monitor – This plugin will display a list of PHP issues as an error log in your WordPress dashboard.

WP_DEBUG – Not a plugin, rather a PHP constant (aka, a permanent global variable), this can be used to trigger debug mode throughout WordPress.

Turning on WP_DEBUG will allow you to see the PHP failure types so that you can fix them in your code. It also allows you to see any deprecated functions that are running on your site (ie, those that exist in WP but are no longer the standard way to perform a particular task).

To turn on debugging, head to your WordPress install files, open the wp-config.php file (located in the root directory), and add the following line of code near the bottom:

Loading gist 1b61c6ea012f69190264e22782c66824

If that line of code already exists but says false, change it to true.

WP_DEBUG set to true
Make sure this code line in PHP matches the one in your file.

Check out this article from our blog, for a more indepth look at using WP_DEBUG.

how to update the PHP version for a collection of popular hosts, including WP Engine, Pantheon, Kinsta, Pagely, Bluehost, Hostgator, GoDaddy, and more.

Hosting with WPMU DEV includes our Hub interface, which greatly streamlines changing your PHP version.

Accessing PHP settings via WPMU DEV’s Hub.

If you prefer a simple solution with a clean UI for checking or updating PHP versions, give WPMU DEV hosting a try, and take one more task off your plate.

caching configuration, uptime monitoring, dedicated IP, nightly backups, free & automated migration, website analytics, and more.

If you ever need help on compatibility issues with your themes or plugins, or have questions about anything WP, our top-rated support team is ready to jump in and assist, 24/7.

Also, every hosting plan is covered by our full 30-day money back guarantee (we’ll happily refund 100% of your money if you decide you don’t like it).

Whether you host with us or elsewhere, keep in mind how much value your host can and should provide.

Choose a company you can trust to take care of those automation and update tasks, like keeping your PHP version current with WP recommendations.

Don’t let subpar hosting steal your focus. You should be able to devote your time and energies to the finer details; making your sites shine with the talents that set you apart from the competition.

Source: wpmudev.com

Discover more from WIREDGORILLA

Subscribe now to keep reading and get access to the full archive.

Continue reading