Knowledge Base


Setting up different PHP Versions in different folders / domains / subdomains for DirectAdmin

STEP 1 : Login to Direct Admin( Guide here )

Select the correct subdomain/domain you want at the top right corner like shown below


STEP 2 − Navigate to System Info & Files-> File Manager. Click on File Manager


STEP 3 − Navigate to the public_html folder. Click on public_html


STEP 3 − Find the .htaccess file , and right click on it, and click Edit


STEP 4 − Add the following lines at the end of the .htaccess file, and click Save Changes on the top right.

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

The above code would enable PHP version 7.1 for the directory. You can change "php71" in the above code to the PHP version you need.

For example, if you need PHP version 7.3, you would use "php73".

And you're done :)

Please rate this article to help us improve our Knowledge Base.

0 0