How to set a different PHP version per domain

In some cases you might require to set a different PHP version per domain or subdomain within the same hosting account. This feature is available on all our hosting packages, but the configuration differs depending on the hosting type.

This guide applies to our cPanel and Plesk hosting packages only. If you are using a cloud hosting package, the PHP version can be changed simply by changing the PHP version dropdown on each application/domain.

This only applies to our shared hosting packages that include cPanel or Plesk.

In order to change the PHP version for your domain or subdomain, simply open the root folder of the desired domain (using the file manager). We will need to modify the .htaccess file, so ensure to disable the option “Do not display hidden files”.

If the file does not exist, please create a new file named .htaccess

Now simply add the following line to the end of the .htaccess file.

<FilesMatch "\.(php4|php5|php3|php2|php|phtml)$">
SetHandler application/x-httpd-alt-php80___lsphp
</FilesMatch>

This example will set the version to 8.0. If you would like to set a different PHP version, please replace the second line with one of the following available options:

SetHandler application/x-httpd-alt-php80___lsphp
SetHandler application/x-httpd-alt-php74___lsphp
SetHandler application/x-httpd-alt-php73___lsphp
SetHandler application/x-httpd-alt-php72___lsphp
SetHandler application/x-httpd-alt-php71___lsphp
SetHandler application/x-httpd-alt-php70___lsphp
SetHandler application/x-httpd-alt-php56___lsphp

Please do not add all those lines, only one that represents the PHP version you would like to configure.

Leave a Comment

Your email address will not be published. Required fields are marked *