Right after this, I will show you how to set up a separate PHP version for each domain. Of course, in case your cPanel has support.
When the host supports using multiple versions of PHP at the same time
Change the PHP version for each domain
1. First, you need to access cPanel of the hosting you are using. Find out if there is a MultiPHP Manager section ? If so, click on it.
2. In the MultiPHP Manager interface , check the domain name you want to change the PHP version, then select the PHP version in the PHP Version section . Click the Apply button to confirm.
3. Wait a moment for the process to complete. Reload the browser tab, you will see PHP version of the domain has been changed.
Change the setting of the PHP version
4. Now it's time to customize the settings for your chosen PHP version. Return to the main interface of cPanel, find the MultiPHP INI Editor and click on it.
5. There are 2 modes to edit PHP settings: Basic Mode with simple interface, easy to use but few parameters to customize. Editor Mode requires a specialized knowledge of PHP but allows more customization.
- With Basic Mode , you just select the domain name then turn on / off or edit the parameters and then click the Apply button .
- With Editor Mode , you must add the following lines of code to the custom PHP parameters via php.in file . That's why I said you need to have an in-depth knowledge of PHP.
Click the Save button to save when finished.
When the host does not support using multiple versions of PHP at the same time
Don't worry, add the following code to the end of the file
.htaccess
in the domain's root directory:
Remember to replace it
php71
with whatever PHP version you want (of course it must be hosted by the host, see the list in Select PHP Version ). For example, if you want to use PHP 7.3, replace it php71
with php73
.
In addition, you can also use the following code to replace in case the above code does not work:
Of course, don't forget to replace it
ea-php56
with the code of the corresponding PHP version you want to use.
As for customizing the module or parameters of PHP, you can do it through the Select PHP Version feature of cPanel:
That's all you need to do to use multiple versions of PHP on one host at a time, each domain running its own version of PHP. It's not too complicated, is it? Good luck!
Post a Comment
Post a Comment