How to Set the PHP Version per Directory in cPanel
How to Set the PHP Version per Directory in cPanel
If you want to use different PHP versions for specific directories, cPanel makes this easy using the .htaccess
file.
Steps to Set PHP Version per Directory:
Log in to your cPanel account.
In the Software section, click on MultiPHP Manager.

Scroll down to the bottom of the page. Select your domain from the left side.
Choose the desired PHP version from the drop-down menu and click on Apply.

Open the
/public_html/.htaccess
file in the cPanel File Manager. You will find the code generated by cPanel.

To set PHP 8 in the directory
forums
, create a.htaccess
file in the/forums/
directory and paste the code generated in the previous step.Congratulations! Your
forums
directory is now using PHP 8. To apply the same PHP version to other directories, simply copy the code from the.htaccess
file and paste it into the new directory.
Last updated
Was this helpful?