Detect PHP Version on CageFS

Overview

On CloudLinux with CageFS enabled, this guide will show you how to set up a hook to detect the correct PHP version and change it for the user. Configuring a pre_install and pre_upgrade hook makes this task simple.

Note : This guide assumes that CageFS is enabled for the user.
Note : This hook will change the PHP version for all the directories of the user.

You just need to rename the pre_install_cagefs.txt and pre_upgrade_cagefs.txt to pre_install_cagefs.php and pre_upgrade_cagefs.php respectively.

For cPanel SSH to your server as root and enter following commands :

Root> cp /usr/local/cpanel/whostmgr/docroot/cgi/softaculous/enduser/hooks/pre_install_cagefs.txt /usr/local/cpanel/whostmgr/docroot/cgi/softaculous/enduser/hooks/pre_install_cagefs.php
Root> cp /usr/local/cpanel/whostmgr/docroot/cgi/softaculous/enduser/hooks/pre_upgrade_cagefs.txt /usr/local/cpanel/whostmgr/docroot/cgi/softaculous/enduser/hooks/pre_upgrade_cagefs.php


For Direct Admin SSH to your server as root and enter following commands :

Root> cp /usr/local/directadmin/plugins/softaculous/enduser/hooks/pre_install_cagefs.txt /usr/local/directadmin/plugins/softaculous/enduser/hooks/pre_install_cagefs.php
Root> cp /usr/local/directadmin/plugins/softaculous/enduser/hooks/pre_upgrade_cagefs.txt /usr/local/directadmin/plugins/softaculous/enduser/hooks/pre_upgrade_cagefs.php


SSH to your server as root and run the following commands for Plesk, ISPManager, ISPConfig, InterWorx, H-Sphere, and CentOS Web Panel:

Root> cp /usr/local/softaculous/enduser/hooks/pre_install_cagefs.txt /usr/local/softaculous/enduser/hooks/pre_install_cagefs.php
Root> cp /usr/local/softaculous/enduser/hooks/pre_upgrade_cagefs.txt /usr/local/softaculous/enduser/hooks/pre_upgrade_cagefs.php
  • That’s it!

Softaculous will now detect the correct PHP version for the CageFS user.