< All Topics
Print

How to utilize different PHP versions in different directories on SkyTechNG Shared Hosting plans

Having the ability to change your PHP version on a directory basis is very sought after, especially by clients running multiple websites. Being able to set multiple PHP versions on your account will allow you to test newer PHP versions on staging websites before deploying them to your live site. Another useful application of this feature is being able to run old projects which you have not found the time to update yet and are using an older PHP version, such as PHP 5.6 or PHP 7.0 for example. Taking advantage of this will not compromise the speed and security of the rest of your websites running on the account by globally changing to an older PHP version. You can have the latest PHP 7.4 running globally for the account and then use the method we are about to explain for the older web applications. To set this up you need to know how to use the .htaccess file. If you are not sure how to do that, please take a look at our What is a .htaccess file and where can I find it article. When you have selected a method of editing the “.htaccess” file and you have opened it, please insert one of the following lines, depending on the PHP version you want to use:

PHP 5.6

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

PHP 7.0

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

PHP 7.1

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

PHP 7.2

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

PHP 7.3

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

PHP 7.4

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

PHP 8.0

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

PHP 8.1

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

PHP 8.2

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

Table of Contents
0