Different PHP versions per directories

Here is an easy instruction of how to setup different PHP versions per directories in our cPanel linux shared and reseller accounts

open the .htaccess file (or create new one if not exists)

The below example shows changing php version to php5.6 in a directory where the main cPanel account is set on a different version.

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

Replace the SetHandler line above for other versions from below versions :

php 5.4 - SetHandler application/x-httpd-alt-php54___lsphp
php 5.5 - SetHandler application/x-httpd-alt-php55___lsphp
php 5.6 - SetHandler application/x-httpd-alt-php56___lsphp
php 7.0 - SetHandler application/x-httpd-alt-php70___lsphp
php 7.1 - SetHandler application/x-httpd-alt-php71___lsphp
php 7.2 - SetHandler application/x-httpd-alt-php72___lsphp
php 7.3 - SetHandler application/x-httpd-alt-php73___lsphp
php 7.4 - SetHandler application/x-httpd-alt-php74___lsphp
php 8.0 - SetHandler application/x-httpd-alt-php80___lsphp
php 8.1 - SetHandler application/x-httpd-alt-php80___lsphp

 

If you have any doubts, please feel free to contact our support team and our team will assist you in configuring the above.

 

 

  • php, php version, lsapi
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

PHP Turn On or Off Error Reporting

Error reporting is useful for debugging purposes. As well, perhaps you have some unimportant PHP...