We support multiple PHP versions per account and domain on servers with CloudLinux. By creating a .htaccess file, you will be able to define the PHP version to be run in that folder or domain. You can create a .htaccess file using the filemanager or a FTP client.


DirectAdmin .htaccess location

For DirectAdmin, the domain folder you want to edit can be found in

/domains/yourdomain.com/public_html
or

/domains/yourdomain.com/private_html


cPanel .htaccess location

For cPanel there are multiple locations possible. Navigate to Domains and click on the Document root next to the domain where you want to change the PHP version for.


Configure the PHP version for a domain

Open or create the .htaccess file if it does not exist. Enter the following line. Replace php80 with the exact version you would like to use. E.g. if you woud like 7.1, replace it with php71. If you want 5.6, replace it with php56.


For cPanel:

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


For other panels (DirectAdmin and Plesk):

AddType application/x-lsphp80 .php

Save the .htaccess file. The new PHP version is immediately active.


To change the PHP settings, navigate to the PHP selector and choose the PHP version you want to manage. Do not click on Set as current version. If you do, you will change the default PHP version for the full account. Change the modules or click on Options to change the PHP options.


Note: This does not change PHP versions on command lines.


Configure the PHP version per folder

Navigate to the folder where you wish to use a different PHP version. Continue with the steps with Configure the PHP version for a domain.