Using CloudLinux with 4xhost allows for greater flexibility in managing PHP versions for your web applications. This feature is particularly useful when certain applications require specific PHP versions for compatibility or performance reasons. While you cannot select different PHP versions for addon domains or subdomains directly through the PHP Selector UI in cPanel, you can manually configure it via the .htaccess
file.
Setting a Custom PHP Version for Addon Domains or Subdomains
To set a specific PHP version for an addon domain or subdomain, follow these steps:
-
Log into Your cPanel Account:
- Access your control panel using your credentials.
-
Navigate to File Manager:
- Go to Files and then select File Manager.
-
Locate the .htaccess File:
- For an addon domain, navigate to
public_html/youraddondomain.com
. - Make sure hidden files are visible by checking the Settings in the upper right corner of the File Manager.
- For an addon domain, navigate to
-
Edit the .htaccess File:
- If the
.htaccess
file already exists, select it and click on Edit from the toolbar. If it doesn’t exist, create a new.htaccess
file.
- If the
-
Add PHP Handler Code:
-
In the
.htaccess
file, you need to specify the PHP handler for the desired PHP version. Replace or add the existing handler with the following lines based on the PHP version you want to use: -
For PHP 5.6:
-
For PHP 7.4:
-
After saving your changes, your addon domain or subdomain will now utilize the specified PHP version, allowing for optimal performance and compatibility with your applications.