By Patrick Jackson on Sunday, 20 September 2020
Category: September

How do I update my PHP version?

Speed, security, compatibility, performance. These are just four of the reasons you should keep your PHP version up to date. In this 2020 revision on the topic, we cover a number of ways you can go about updating your PHP version to avoid problems in the lead up to the release of Joomla 4 which has a minimum requirement of PHP version 7.3 or above.

I’m getting a warning in Joomla about my PHP version not being supported when I log in as Administrator. Help!?!

If you’ve logged into your Joomla Administrator area and have been greeted with a message like the one above, don’t panic. Joomla has a recommended minimum PHP requirement at the time of writing of PHP 7.3 or higher. The current official release of PHP is version 7.4.

In addition to the PHP Version Check message that can appear if you’re using a version of PHP lower than 7.3, Joomla 3.10 will have a PHP warning message about PHP versions before you attempt to migrate to Joomla 4 when it is released.

With Joomla 4 a large amount of previous legacy code has been removed. At the same time, a lot of new modern code has been added. Having the correct version of PHP is going to be essential for Joomla 4 to work, as the new code utilises the improved features and functions PHP 7.3+ provides.

Recommended PHP Version and Technical Requirements for Joomla

Currently, Joomla 3 has a minimum PHP version technical requirement of 5.3.10, and since Joomla 3.5 was released in April 2016, the recommended version of PHP to be used for Joomla has been PHP 7. Since November 2019, the recommendation has been PHP 7.3+.

There’s a big reason behind the recommended version now being PHP 7.3+, and that’s due to PHP versions lower than 7.3 having reached end of life. So if your website is still using PHP 5.6 or earlier, or PHP 7.2 or earlier, then the possibility that your website will encounter compatibility issues with updates, or security issues due to vulnerabilities that can be exploited is much higher.

If your hosting provider is not providing you with the ability to use PHP 7.4 currently, then ask them why, and if they can’t, consider whether your hosting is working well for you.

Updating your PHP Version

There are a variety of ways to change your PHP version on your hosting, and it comes down mainly to which hosting platform your hosting provider is using.

Two of the most common hosting platforms available today are cPanel and Plesk, and so we’ll cover where you can typically find options to change your PHP version if your hosting provider has made that option available to you.

If you use cPanel or Plesk and the settings outlined below are not available to you, contact your hosting support as they might have disabled the functionality in shared hosting accounts on their servers.

If your hosting uses a custom control panel interface, then you may need to contact your hosting support to ask them to change the version of PHP available.

Upgrading PHP version in cPanel with EasyApache MultiPHP

  1. Log in to cPanel
  2. Find the “MultiPHP Manager” function by searching for “MultiPHP”, or find it in the Software section of the cPanel

  3. Make a note of your current version in case there’s a problem.
  4. Select the new version of PHP and click “Apply”. If there’s an option indicating the “inherit” option, that will mean that it continues to use the server’s default PHP version. However, depending on other aspects on the server this may not always apply correctly.

  5. Visit your site to confirm that the change has not broken your site.

Upgrading PHP version in cPanel with CloudLinux LVE

  1. Log in to cPanel
  2. Find the “Select PHP Version” function by searching for “PHP”, or find it in the Software section of the cPanel

  3. Make a note of your current version in case there’s a problem.
  4. Select the new version of PHP and click “Set as Current”. If there’s an option indicating the “native” option, that will mean that it continues to use the server’s default PHP version.
  5. Visit your site to confirm that the change has not broken your site.

Upgrading PHP Version in Plesk

  1. Log in to Plesk.
  2. Go to Plesk > Domains > [Your domain] > PHP Settings

  3. Make a note of the existing settings.
  4. Select the new version of PHP to use from the version dropdown. Also note the initial setting of the “run PHP as” option, as that might be something that is enforced by your hosting provider. If it changes when you select the PHP version, also change this value to match the previous value or you might end up with a system error.

  5. Click Apply
  6. Visit your site to confirm that the change has not broken your site.

Setting PHP version using AddHandler in .htaccess file

You can also use .htaccess files in Apache to switch your PHP version. You might find that in changing the cPanel PHP version, the following lines are added to your .htaccess automatically.

After changing cPanel to PHP 7.4 in the steps above, my .htaccess file now has the following contents:

What this line does is tell the server how to handle PHP files, by using a MIME Type to define the application version of PHP to use.

AddHandler application/x-httpd-ea-php74 .php .php7 .phtml

You can add a variation to your .htaccess file to switch PHP versions if your server supports that setting, and you already have other PHP versions installed.

Updating PHP version on a VPS or Dedicated Server

If you’re a server administrator or have your own VPS or Dedicated Server that you have root admin privileges for, you will usually be able to update your PHP version by adjusting the server settings.

If you’re not confident about making changes to your server, your provider’s support staff should be able to assist you with making the necessary changes.

Here are a number of resources on how to do that for different installations.

Update your WHM/cPanel server using EasyApache4

The simplest way to upgrade WHM so that the server has the latest version of PHP available, run EasyApache4 to update your Apache version, PHP versions and related modules.

Find out more…

Update your Plesk Server to install an additional PHP version

You can add additional PHP versions to Plesk via either the Plesk Administration interface for your server or via the command line interface.

Find out more...

Updating PHP version on your local LAMP installation

If you’ve installed a test environment locally on your computer (See June’s Joomla Community Magazine article Installing a Test Environment), the best way to install a new version of PHP would be to update your LAMP installation.

New versions of various installers are regularly released that support the latest versions of PHP, and typically you can install the update and your versions will be updated automatically.

Troubleshooting Tips

PHP is a server-level application layer. So this means that when something goes wrong, it really goes wrong, and most commonly brings your website down with a number of errors.

Over time I’ve only encountered a handful of errors when switching PHP versions, and the two most common (both which I triggered while creating screenshots for this article) are:

You can find (and contribute) additional troubleshooting tips on the Updating PHP page in JDOCs.

An alternative that is not recommended

Joomla 3.9 will work on PHP 7.2 and above, but as mentioned at the start of the article, you will get a warning message if your PHP version is below the current required version.

Often upgrading PHP may not be done straight away, though I hope you can see how easily it can be done if you’re with a quality hosting company. Joomla administrators may feel uncomfortable when they PHP warning messages, and so there is a way to disable the PHP version check, though upgrading PHP and keeping Joomla also updated should be your preferred path.

Here’s how to disable the PHP Version Check message:

Further Resources

The variety of available server configurations means that covering every variation in a magazine article is not practical.

To allow for other methods to be documented, a page on JDOCs has been created. Please contribute further methods and troubleshooting tips on the Updating PHP page in JDOCs.


 This article updates the information previously available in one of the Joomla Community Magazine's most visited articles How to upgrade your website PHP version by Parvez Akther from May 2016.

Leave Comments