A: Change PHP Version for Complete Hosting Account
Step 1: Log in to Dashboard and control panel
First of all, make sure that you are logged in to the dashboard, and then go ahead and log in to the hosting control panel. You can find the step-by-step tutorial to login into Control Panel through the dashboard here.
Step 2: Look for Select PHP version
Scroll down and look for the Select PHP version button under the Extra Features section.
Finally click on the dropdown and select the PHP version as per your convenience.
That’s All! Your PHP version should be changed successfully now.
B. Change PHP version per directory
The PHP version is important not only for speed and performance. There are different applications, which sometimes may require specific PHP versions. With SiteCountry, all our cloud hosting clients can set specific PHP versions for different directories/domains/subdomains. For example, if you want to run PHP 8.0 on your account, but you have to set PHP 7.4 on any particular domain because of your specific application requirements, you can do that by setting custom rules for each of your folders. In this post, we will explain how to run multiple PHP versions on the very same account.
While this option is not directly accessible in our control panel, it is possible to have a different PHP version for an addon domain, subdomain, or on a per-folder basis by using handlers in your site’s .htaccess file.
You can easily change the PHP version on your account by using one of the following handlers, according to your desired PHP version.
How to set PHP 5.6 version for a specific domain.
Let’s have a practical example of how to set the PHP 5.6 version for any one of the domains.
.htaccess file in the desired directory or modify an existing .htaccess file where you want to have a different from the default PHP version with the following handler:
# SiteCountry Custom PHP Version 5.6
<FilesMatch "\.(php4|php5|php3|php2|php|phtml)$">
SetHandler application/x-lsphp56
</FilesMatch>
# Custom PHP Version Code Ends
As a result, an addon domain, for instance, will use the PHP 5.6 version which you’ve set for it, and not the global one set for the account in the Control Panel > PHP Selector.
How to set PHP 7 version for a specific domain.
Let’s have a practical example of how to set the PHP 7 version for any one of the domains.
.htaccess file in the desired directory or modify an existing .htaccess file where you want to have a different from the default PHP version with the following handler:
# SiteCountry Custom PHP Version 7
<FilesMatch "\.(php4|php5|php3|php2|php|phtml)$">
SetHandler application/x-lsphp70
</FilesMatch>
# Custom PHP Version Code Ends