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.