This article describes how to set the PHP version for a specific directory. Normally, when you set the PHP version in cPanel using the PHP Selector, that version is used for the entire account. However, if you want to use a different PHP version in a specific directory, you can do so.
To change the PHP version for a specific directory, follow these steps:
<FilesMatch ".(php4|php5|php3|php2|php|phtml)$">
SetHandler application/x-httpd-alt-phpXX___lsphp
</FilesMatch>
Save the .htaccess file. The new PHP version takes effect immediately.
To verify the new configuration, create a PHP file that runs the phpinfo() function. Load the file in your web browser, and confirm the PHP version. For example:
For more information about the phpinfo() function, please visit https://www.php.net/manual/en/function.phpinfo.php.
Subscribe to receive weekly cutting edge tips, strategies, and news you need to grow your web business.
No charge. Unsubscribe anytime.
Did you find this article helpful? Then you'll love our support. Experience the A2 Hosting difference today and get a pre-secured, pre-optimized website. Check out our web hosting plans today.
We use cookies to personalize the website for you and to analyze the use of our website. You consent to this by clicking on "I consent" or by continuing your use of this website. Further information about cookies can be found in our Privacy Policy.