How to Change PHP Version with htaccess

How to Change PHP Version with htaccess

For those of you who experience difficulties when you want to change the PHP version (PHP Version) on hosting but the hosting does not have the Multi PHP Manager feature, you can solve this by changing or adding code to the .htaccess file
Following is the code


Versi 5.1

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

Versi 5.2

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

Versi 5.3

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

Versi 5.4

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

Versi 5.5

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

Versi 5.6

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

Versi 7.0

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

Versi 7.1

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

Versi 7.2

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

Versi 7.3

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

Versi 7.4

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

Versi 8.0

#php – BEGIN cPanel-generated handler, do not edit
#Set the "ea-php80" package as the default "PHP" programming language.
AddHandler application/x-httpd-ea-php80___lsphp .php .php8 .phtml
#php – END cPanel-generated handler, do not edit

Versi 8.1

#php – BEGIN cPanel-generated handler, do not edit
#Set the "ea-php81" package as the default "PHP" programming language.
AddHandler application/x-httpd-ea-php81___lsphp .php .php8 .phtml
#php – END cPanel-generated handler, do not edit

Versi 8.2

#php – BEGIN cPanel-generated handler, do not edit
#Set the "ea-php82" package as the default "PHP" programming language.
AddHandler application/x-httpd-ea-php82___lsphp .php .php8 .phtml
#php – END cPanel-generated handler, do not edit

Comments (0)
Login or create account to leave comments