PHP Selector is a tool that enables users on the server to have their own fully customizable and flexible PHP environment. It allows the user to switch between different PHP Versions, such as PHP 5.2, PHP 5.3, PHP 5.6, PHP 7.0, and PHP 7.1, based on the user's needs.
You can configure the server to use different PHP versions on your subdomains and directories by adding the SetHandler code in the .htaccess file of the folder to override the default PHP version.
You can follow the steps below to configure the PHP versions for your subdomains or directories PHP Selector.
- Firstly, log in to your cPanel
- Now, navigate to the Software section > Select PHP Version
- Then, select the desired PHP version from the drop-down list, click Set as current, and Save the change.
You can also use different PHP versions per directories by using mod_lsapi,
- Firstly, setup mod_lsapi
- Now, for EasyApache 4 servers - you should already have a /etc/container/php.handler file.
- Lastly, you will have to create a .htaccess file in the desired directory where you want a different PHP version with the correct handler.
Include the below code to the .htaccess file for the EasyApache4 server:
<FilesMatch "\.(php4|php5|php3|php2|php|phtml)$">
SetHandler application/x-httpd-ea-php71-lsphp
</FilesMatch>
SetHandler application/x-httpd-ea-php71-lsphp
</FilesMatch>
I hope the above information helps you set the PHP version for each subdomain or directory using PHP Selector.
-----------------------------
Regards,
Rex Maughan
Leave a comment: