Detect PHP Version on CageFS

Overview

This guide will help you to configure a hook to detect the correct PHP version and change PHP version for the user on CloudLinux with CageFS enabled. This task can be done easily by configuring a pre_install and pre_upgrade hook.

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


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

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.

Was this helpful to you?