Which PHP Version to Use With WordPress?

Which PHP Version to Use With WordPress?

PHP is one the most widely-used scripting languages today. Because of its versatility, it has been put to many uses over the years. For example, PHP can be used to manage databases, build entire sites, or manage dynamic content.

Released in 1995 by Rasmus Lerdorf, PHP came out as open source and open for public use and adaptation. Since then it’s undergone significant transformation. Because of this, PHP itself has at times evolved significantly between releases.

The following review includes essential information, such as:

What PHP Versions are Compatible With WordPress?

How to Find out Which PHP Version You’re Using

The Advantages of Upgrading Your PHP Version

Disadvantages of Using an Older PHP Version

How to Safely Upgrade Your WordPress PHP Version

Upgrading Your PHP Version with ScalaHosting

Updating Your PHP Version Manually on Your Server


Frequently Asked Questions

What PHP Versions are Compatible With WordPress?

Which PHP Version to Use With WordPress?
Newer versions of WordPress require more modern iterations of PHP. (Source: DisplayWP)

As with PHP, WordPress itself has evolved over time. Each time applications evolve, their requirements may change. To add to the complexity, not all WordPress users always keep their version current.

Support for PHP in WordPress was first introduced with WordPress version 2.0 – at the time, it was partially compatible with PHP version 4.0. Over time as WordPress advanced, the minimum supported versions of PHP moved forward as well.

For instance, since WordPress version 5.2, it has become mandatory for users to have at 

the minimum of PHP version 7.2.

How to Find out Which PHP Version You’re Using

Thankfully, WordPress was designed for the modern era and helps users handle things more easily. This goes the same for something minor like trying to find out the PHP version that’s currently being used by your WordPress installation.

In fact, there are a number of ways you can do this:

1. From your Control Panel

With most web hosting plans comes access to a control panel that lets you manage your account. Typically, this will either be Plesk or cPanel. Regardless of that, somewhere there will be an option for you to manage web scripting or even PHP directly. Clicking on that will enable you to know what version of PHP your server is currently running.

2. In WordPress

Which PHP Version to Use With WordPress?

By far an easier solution, all you need to do is open your WordPress admin panel. There, go to Tools and click on ‘Site Health’. At the top of the page, select ‘Info’ and scroll down towards ‘Server’. Expanding that option will show you various information about the server your WordPress is hosted on, including the PHP version.

3. Using Command Line Instructions

If for some reason the above two methods are not available (or not preferred) then simply jump into the command line interface for your server. Then, type in ‘php –version’ or ‘php -v’ and you should see the package that you have already installed.

The Advantages of Upgrading Your PHP Version

Under most circumstances, it is always better to keep your applications updated, no matter what you’re using. Earlier, we discussed the fact that as WordPress moves forward, it requires PHP versions that keep up with it. There are a few core reasons for this.

Key advantages of keeping PHP updated include:

Better Performance

Since introduction, each new PHP version has proven to offer much better performance over the last. For example, PHP 7.4 has been noted to boost script loading speeds of between 30-50% on average. This can result in a much faster WordPress site for you.

Improved Security

Almost entirely without fail, newer versions of anything coded come with improved security. Not all of this is always a new development or facet of security. In fact, improved security most of the time refers to patching that has been done to resolve existing vulnerabilities discovered as the application is being used.

New Features

At times, newer versions of PHP come with new features or sometimes, improvements to existing features. This means your site might be able to make use of new functionalities that weren’t possible before. 

Disadvantages of Using an Older PHP Version

As you can see from the advantages, not updating your PHP version can result in you missing out on some things. While being able to accept slower speeds is one thing, ignoring a fix for known vulnerabilities is simply asking for disaster.

Finally, assuming you keep your WordPress updated, there will eventually come a point where it will no longer support the older PHP version you’re on. At that point of time you either have to update PHP or simply stop updating WordPress.

How to Safely Upgrade Your WordPress PHP Version

By nature, WordPress will attempt to use whatever version of PHP you have installed on your web server. That means if you want to update PHP, it’s done on the server, not from inside WordPress.

The best way to achieve this is to make use of your web hosting control panel. There will be an option for you to select the PHP version you want – simply from a dropdown menu. 

Note: Not all web hosts will offer the same versions of PHP. This is especially important to take note of if you need to use any specific version, especially if you’re on a shared hosting plan.

Updating PHP in Plesk

From the control dashboard of the website you want to manage in Plesk, click on the option ‘Hosting Settings’. From there, scroll down to ‘PHP support’ and select the version you want from a dropdown menu. 

Updating PHP in cPanel

In cPanel, scroll down to the ‘Software’ section and look for an option called ‘Select PHP version’. Clicking on that will show you the current PHP version with a small inverted triangle next to it. Select that icon and you can choose from a list of available PHP versions.

Upgrading Your PHP Version with ScalaHosting

Which PHP Version to Use With WordPress?

ScalaHosting makes use of SPanel, an advanced control panel which is highly capable and doesn’t come with the burden of additional licensing fees. It’s simplicity of use can be seen in the PHP selector as well.

All you need to do is login to SPanel and scroll down to ‘Tool’ to select ‘PHP manager’. The next screen will show you the current version of PHP being used. Simply click ‘Change’ to select from a list of available PHP versions.

Updating Your PHP Version Manually on Your Server

If for some reason you want to bypass the control panels and update your PHP from the command line, that’s possible as well. For the following instructions, replace sudo with the appropriate command needed for the particular distribution you’re working on:

  • sudo add-apt-repository ppa:ondrej/php
  • sudo apt-get update
  • sudo apt-get install php7.4 php7.4-fpm php7.4-xml php7.4-mysql php7.4-gd

This will install not just PHP but the other extension libraries that it needs as well. Once you’re done, you will need to enable the new module and if necessary, disable the older ones.

In the interest of streamlining, we’re going to look at how to do this only on Apache and Nginx. Before you decide to do this, ensure that you create backup copies of any files that you may be editing in the process.


Of the two web servers, Nging is a bit more complicated to manage than Apache for handling PHP. You will have to work with some configuration files.

Open the configuration file for the PHP-FPM socket:

sudo vim /etc/nginx/sites-available/default

In that configuration file, swap to the new socket:

location ~ \.php$ {

     include snippets/fastcgi-php.conf;

fastcgi_pass unix:/run/php/php7.4-fpm.sock;


Save the file and restart Nginx:

sudo service nginx restart


Disable the PHP versions you no longer need:

sudo a2dismod php7.0

Then enable the new one:

sudo a2enmod php7.4

Restart Apache:

sudo service apache2 restart


Since PHP is such a popular scripting language to use, many applications and control panels have implemented easy ways of working with it. As you can see from the instruction in safely updating your PHP version, it can be as easy as choosing from a dropdown menu.

Manual installations are still relatively easy though, especially for those who are used to the command line interface. Ideally, look over new PHP releases carefully since not all will have the major benefits discussed here.

Frequently Asked Questions

Can you use PHP in WordPress?

Yes, however perhaps not in the general interpretation of the word ‘use’. It is not possible to insert and use PHP code directly in WordPress pages or posts. Instead, they are written as complete scripts and then adopted by the theme you’re working with.

What PHP version does WordPress use?

The latest version of WordPress 5.5 recommends that it be used with PHP version 7.4 or newer. However, it is backwards compatible until version 5.6.2. Earlier PHP versions than that will no longer work with WordPress.

Should I learn PHP for WordPress?

It is entirely unnecessary to learn PHP in order to use WordPress. For most general usage, WordPress users are not required to learn any form of coding. The exception to the rule is for those who wish to create custom scripts for their own site – or even general release.

Will updating PHP break my site?

Updating PHP is typically a safe process and should not have any adverse effects on your site. If you run many plugins with your WordPress site, there may be compatibility issues. In those situations, make sure you attempt an installation on a staging clone for your site first.

How do I install PHP on WordPress?

PHP is installed on the web server and used in WordPress. If you’re using shared hosting, it should come pre-installed and you can select the version from your control panel. For VPS, PHP may or may not come with PHP pre-deployed, depending on your host.

Vlad G.


Vlad has 20 years of experience in the web hosting industry. He wants to make the Internet a safer place for everyone by allowing every online business to have their own fully managed VPS with a control panel and daily backups at the same price as shared hosting. Vlad is a performance-driven individual who is passionate about technology, innovations, and leadership. He believes that every website should be hosted on its own server as that is the only way to achieve maximum security, speed, and reliability. Vlad is currently a co-founder and CEO of Scala Hosting LLC and SPanel LLC.

Write a Comment