dual php version in same c panel
https://support.hostinger.com/en/articles/4047803-how-to-change-php-version-for-subfolders-or-subdomains
How to change PHP version for subfolders or subdomains?
This article will help you to change PHP version without using the panel.
Yuliia B. avatar
Written by Yuliia B.
Updated over a week ago
If you are updating the PHP version for the whole domain, you can do it directly in hPanel.
In case you'd like to change the PHP version for a specific subdomain or subfolder, all you need to do is:
Step 1 - Open your .htaccess file
First, access your File Manager:
Then, access the folder to which you would like to apply a different PHP version. If you want to edit a subdomain, access its folder. In this folder, open the .htaccess file by double-clicking on it.
If the file doesn't exist, you can create it directly in the File Manager. Make sure to include a dot (.) at the beginning of the filename!
NOTE:
How to create an .htaccess file?
Step 2 - Edit .htaccess file
Add the following code to your .htaccess file (the very beginning of it):
SetHandler application/x-lsphp71
The second line is what defines which PHP version your folder will be using. All you need to do is change it based on the version that you would like to use.
PHP version
Code
5.2
application/x-lsphp52
5.3
application/x-lsphp53
5.4
application/x-lsphp54
5.5
application/x-lsphp55
5.6
application/x-lsphp56
7.0
application/x-lsphp70
7.1
application/x-lsphp7.1
7.2*
application/x-lsphp73
7.3
application/x-lsphp73
7.4
application/x-lsphp74
8.0
application/x-lsphp80
*PHP versions up to this one are currently considered outdated and are no longer supported
NOTES:
To check, if the change was applied correctly, you can create a phpinfo.php file
Changing PHP versions using files is not recommended, as it doesn't include PHP extensions and options. Thus, it might affect the website's work
Did this answer your question?
Comments
Post a Comment