WHMCS Auto Install Module
This guide will help you to setup WHMCS to auto-install scripts during user account creation. Setting this up is very easy. This guide assumes that you have already installed Softaculous on your server.
Note: This works only with cPanel and DirectAdmin at the moment.
List of Scripts
All the scripts in Softaculous can be Auto Installed. Following is the popular list of scripts :
WordPress, b2evolution, StatusNet, Drupal, Mambo, phpBB, SMF, AEF, Coppermine, Gallery, Jcow, OpenClassifieds, openX, WebCalendar, Shadows Rising, phpList, SquirrelMail, LimeSurvey, Piwik, SugarCRM, PHProjekt, osCommerce, Magento, phpBook, HESK, osTicket, kPlaylist, VidiScript, Gregarius, CodeIgniter, Moodle, Elgg.
(See the first pic to see where you have to add the names of scripts, the box outlined in red is where you add the list of scripts.)
Download and Upload
Download the Auto Installation Hook from the Downloads Sections.
Unzip it and upload the file called softaculous.php, in your /path/to/whmcs/includes/hooks/ Directory. If you want to debug for any errors or test the Auto Install is working properly please also upload the softaculous_debug.php file in your /path/to/whmcs/includes/hooks/ Directory. You can remove the softaculous_debug.php file later after it works successfully.
If you want to add Auto Installation for Custom Scripts then please modify softaculous_extra.php and upload it as well. Otherwise you dont need to upload softaculous_extra.php
Editing a Product/Service
Now login to your WHMCS Admin Panel. This guide assumes you have already setup WHMCS to create user accounts automatically. If you have not already setup your server you can find detailed guides on the WHMCS Wiki
Setup Custom Fields
Go to Setup -> Products/Services and click on the Edit Product Icon of the Product you wish to setup Auto Installation for.
In the Edit Product section, click the 'Custom Fields' tab.
In the Custom Fields tab > Add New Custom Field.
We will have to add 4 Custom Fields.
You can only add 1 Custom Field at a time, so after adding the first field hit the 'Save Changes' button, for the 2nd field to show up.
This is how we add custom fields.
See the images below for the 4 custom fields.
Note : You can give "None" as the first option in the List of Scripts. If users dont want to install a script when their account is created, they can choose "None" to refrain from installing any script.
Very Important Note : Fill in the fields name as per the image only. IF you wish to modify the Field Names (e.g. "Admin Username" instead of "Admin Name") then you must upload the softaculous_extra.php file as well (it has sample code to modify the field names).
Setup Module Run Time
The Softaculous Hook will run and try to Auto Install the script only when the account is being created. This option can be found while editing the Product/Service in Module Settings Tab. You can choose any of the option in the image shown below. Just remember that Softaculous will create the account only as per the method you select.
Once you are done with the 4 fields, hit the Save Changes button and you are done.
Testing the Setup
You can test the setup by making a DUMMY Order and going to the settings of that order.
For debugging purposes upload softaculous_debug.php in the /path/to/whmcs/includes/hooks/ Directory. If you dont upload the softaculous_debug.php no error messages will be shown.
Make sure the Admin Name and Admin Pass are setup and the desired script is selected e.g. WordPress
Then click on the Create button to create the account on the server.
You will see a Box shown in the following image
When the page reloads (assuming debugging is enabled) the following message will be shown in case of success :
Incase of Failure errors will be shown (assuming debugging is enabled).
There could be several reasons for the Hook Not to work :
- A firewall is blocking requests
- You put the incorrect Field Names
- cURL is disabled in PHP
Remove Debug File
Please remove the softaculous_debug.php file after you have successfully setup the Module.
If you have made a Custom Script in Softaculous and want to enable Auto Installation of that script via WHMCS then please upload the file softaculous_extra.php as well in the hooks folder.
Before uploading the softaculous_extra.php file, please modify it and add the scripts you want to automate installation of.
Please note that the ID of the custom script must be the same as that of the Custom Script in Softaculous Admin Panel.
If you need any assistance then please contact Softaculous Support. Please send us a screenshot of the Order Form and the Custom Fields you added to the Product.