There are upcoming maintenance events which may impact our services. Learn more

How to run a different PHP version on subdomain/subfolder on a shared server Print

  • php version, change php, update php, add php version
  • 0

To run a PHP version on the server from that is assigned by default under your cPanel Control Panel -> "Select PHP Version", please add this line to your .htaccess file:

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

Where x-httpd-alt-php56___lsphp is the PHP version you are seeking. Our servers support PHP 5.6 - 8.x+

The part php56  is interchangeable to php73  for PHP 7.3  ,  php80  for PHP 8.0

Here are some examples:

 

PHP 7.4:

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

 

PHP 8.1:

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

 

PHP 8.3:

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

 

For more information on how alternative PHP version works for subdomains and sub folders, please see:

https://cloudlinux.zendesk.com/hc/en-us/articles/115004537805-Different-PHP-versions-per-directories-using-mod-lsapi


Was this answer helpful?

« Back

Powered by WHMCompleteSolution