1. Home
  2. cPanel/WHM
  3. How do I change the PHP version?

How do I change the PHP version?

Den här artikeln finns även på svSvenska

You can choose what PHP version you want to use for your web hosting account in cPanel. Before you change remember to check that the PHP version you choose is compatible with software that you are using, for example the version of WordPress or Joomla that you are using. Information about this is available from each developers web site.

It is possible at any time to change back to the version you used earlier if it turns out that your web site did not work after the change.

For information about how to activate/deactivate PHP extensions please check this guide.

Global change

To change which PHP version your entire hosting account uses you need to do the following.

Login to cPanel and find the category Software. In this section you will find an icon named Select PHP Version, click on it.

Link to PHP Version module

At the top of the page you can see which PHP version you are currently using (Current PHP version) and in the drop down menu under it you can see which PHP versions that are available. Select the version you want to use from the drop down and then click Set as current. You are now using the chosen version of PHP.
Välj PHP version

Local change

You can set a specific PHP version for a single folder on you account. This way you can run different versions of PHP for different parts of your account even though the global setting is set to another version.

To do this you have to edit the .htaccess-file that is in the folder for which you want to set a PHP version for. If the .htaccess file does not exist you can create it. You can do this using for example the File Manager in cPanel (remember to activate viewing of hidden files if you are using the File Manager).

When you have opened the .htaccess-file for editing you will have to enter this code at the top of the file:

AddHandler application/x-httpd-alt-php73___lsphp .php .php7 .phtml

73 means PHP 7.3, replace it with the version you want to use, for example 56, 72 and so on.

Was this article helpful?

Related Articles

Behöver du mer hjälp?
Kan du inte hitta lösningen på ditt problem? Då kan du kontakta oss via e-post, chatt och telefon!