Softaculous Hook

Softaculous is a plugin which can be integrated into cPanel and can be installed into cPanel in just 2 minutes. Softaculous is tightly integrated with cPanel and your users can access 444 apps. Softaculous takes care of the complete lifecycle of the application from install to backup to update. Softaculous is widely used in the Web Hosting industry and it has helped millions of users install applications by the click of a button. Softaculous Auto Installer easily integrates into leading Control Panels like cPanel, Plesk, DirectAdmin, InterWorx, H-Sphere.

Incorrect PHP version in Softaculos is one of the common which client used to face

If the default the PHP of the server is at end of life and softaculous is not detecting the latest custom PHP or if you want over-ride PHP version check on softaculous. Please follow the below steps.



1) move the /usr/local/cpanel/whostmgr/docroot/cgi/softaculous/enduser/hooks/pre_install.txt to /usr/local/cpanel/whostmgr/docroot/cgi/softaculous/enduser/hooks/pre_install.php

2) Add the following lines in function __pre_install()
----
function __pre_install(){
global $soft, $software, $globals;
// Do stuff here e.g. is as follows
if($soft == 26){ /* Do things only if its WordPress */ }
$version = 'latest php version or custom compiled php version ';
define('php_version', $version);
}
?>

example:

function __pre_install(){
global $soft, $software, $globals;
// Do stuff here e.g. is as follows
if($soft == 26){ /* Do things only if its WordPress */ }
$version = '5.6.0 ';
define('php_version', $version);
}
?>

----

Please note that we are manually defining a version for php here. Softaculous will no longer complaint if domain is in different version

Refer : http://www.softaculous.com/docs/Hooks

If we need to upgrade any software using softaculous you need to hook the “pre_upgrade.php” file. You will have to configure the pre_upgrade hook because the pre_install hook is not triggered during the upgrade process :

There will be a file pre_upgrade.txt in /usr/local/cpanel/whostmgr/docroot/cgi/softaculous/enduser/hooks/ You need to rename it as pre_upgrade.php and you need configure this file similar to pre_install.php.



[email protected] [/usr/local/cpanel/whostmgr/docroot/cgi/softaculous/enduser/hooks/# mv pre_upgrade.txt pre_upgrade.php

root@sarathatwork[/usr/local/cpanel/whostmgr/docroot/cgi/softaculous/enduser/hooks]# vi pre_upgrade.php

add the below lines under "global $soft, $software, $globals;" line and the save the file.
$version = '5.3.2';
define('php_version', $version);

So you can now upgrade the software now.

If you need any further assistance contact me @ [email protected].. prefer hangout 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.