It is possible to set PHP manually to different versions for each directory. First choose your preferred PHP version that will be applied for all sites (directories including root), by default we have set it as PHP 7.4, you may change it in PHP selector as you wish.

If you have created additional domains or subdomains, go that particular folder (inside public_html) and create a .htaccess file, using the File Manager. This .htaccess is different from the one that you will have in root. If you wish to change the php Version for root then edit the .htaccess file in root.

Open the .htaccess file and copy the below code (staring from #+PHPVersion to #-PHPVersion) and save. Type your php version number, for example, php56 for PHP version 5.6 and php70 for PHP version 7.0

In the below example, we are showing the codes for PHP version 5.6 (Anything after # is optional, choose your desired text).

 

+PHPVersion

#="php74"

AddHandler x-httpd-php56 .php

#-PHPVersion



To verify, if you have properly created, create another file in the name of phpinfo.php and add the below code and save. Now access the file from your website as public and check if it populates the chosen php version. For example, www.example.com/phpinfo.php should show the PHP version that we have given in the .htaccess file.

<?php

phpInfo();

?>

This should have solved your question. Hope this was helpful to you.

Hjalp dette svar dig? 27 Kunder som kunne bruge dette svar (97 Stem)