Which version of PHP is best for WordPress?

Beginning with WordPress 5.2, WordPress introduced the Site Health Check. On your Dashboard, you’ll see a warning if your website has a technical issue that needs to be addressed. One of those things is the version of PHP your website is running. You might be wondering why WordPress cares what version of PHP you run or what that even is. Let’s take a closer look at what PHP is, how to tell what version you’re running, why it matters, and how to upgrade.

PHP: The language of WordPress

From a user standpoint, WordPress is, at its core, a custom interface to help you build a website much more easily than you can from scratch. From a development standpoint, however, WordPress is not only a content management system but also a custom library of PHP functions.

What does this mean? Well, sites on the internet can be written in one of several programming languages. WordPress is written in PHP, and WordPress offers developers what is known as the WordPress Codex. The Codex offers WordPress developers a set of functions to make theme and plugin development easier. For example, you can use the code get_footer() to display the contents of a page’s footer. This is a function possible in WordPress that isn’t possible in regular PHP.

Why does the version number matter?

Because WordPress is built on PHP, that means that the version of PHP you use is as important as the version of WordPress you use. Each version offers new features but it also offers stability improvements and fixes bugs. Perhaps more importantly, new versions of the software also repair security issues.

Like operating systems or other software, previous versions aren’t supported forever. You wouldn’t want to run Windows 98 or Mac OS 9 on a brand new computer, right? Those versions of the software are old and unsupported. You’d miss out on a lot of new features, but you’d also be vulnerable to a bunch of bugs and security issues that are repaired in newer versions of the software. PHP 5.2, released in January 2011, has about 40 known security vulnerabilities. It’s also 400% slower than PHP 7.0.

What version of PHP should you run?

The current major version of PHP is 8.3, released on November 23, 2023.

PHP operates on an annual release cycle, releasing one new version each year and phasing out one each year. PHP supports multiple versions at once at least with security updates, supporting each version for 3-4 years before ending updates completely.  PHP 8.1 was phased out in November 2023. PHP 8.2 will be supported through the end of 2024. Each version also continues to receive security updates for two years after it is no longer actively supported. PHP 8.1 is the oldest version still receiving active updates, and it will continue to receive them through the end of 2025.

PHP 7.2 or newer is required to run the latest version of WordPress. WordPress 6.6, released on July 16, 2024, officially dropped support for PHP 7.1 and older, and WordPress itself recommends at least PHP 7.4. It’s important to note again, though, that PHP 7.4 and 8.0 are no longer receiving security updates. WordPress always allows using a few versions of PHP that are no longer supported, but it is still best to use a newer version that is still receiving updates. Older versions of WordPress support versions of PHP 5, but there is really no reason to run such an outdated version of PHP (or WordPress). Because PHP 8.1 is the lowest version that is still receiving security updates, it is the oldest version you should consider using.

If you want to know exactly what version of PHP you’re running, the easiest way to check your site’s version of PHP is to install a very simple plugin called Display PHP Version. This will add the version of PHP your site runs into your WordPress Dashboard. You can check compatibility with newer PHP versions using the PHP Compatibility Checker plugin. However, assuming you’re running WordPress 5.2 or later, you can also rely on the Site Health Check to warn you if your version of PHP needs to be upgraded.

Before upgrading your PHP version, you’ll want to be sure all your themes and plugins are compatible with it. If your theme and plugins are all compatible with new versions, running PHP at least PHP 8.2 is ideal for now. You should run PHP 8.3 if your theme and plugins are compatible with it.

How do you upgrade your PHP version?

Upgrading depends on your hosting provider. Most major hosts provide a way to upgrade through their cPanel system. Select your hosting provider from the list below to see how to upgrade PHP with that host. If you host isn’t listed, you can probably find upgrade instructions by searching Google for “upgrade PHP” followed by the name of your host.

Comments