buy
Auto Install Script

Overview

If you wish to automate the installation of Scripts you can do that in Webuzo as there is an API Class which enables us to do so.

API Class

You can find the API Class in your Webuzo folder. It's located here :

/usr/local/webuzo/enduser/installapi.php

Understanding the API

The API is a simple class which will pass the data to Webuzo to install a script. Here is a sample example to install a script :

<?php 

@set_time_limit(100); 

$new = new Soft_Install(); 
$new->login = 'http://user:password@domain.com:2002/index.php'; $new->data['softdomain'] = 'domain.com'; // OPTIONAL - By Default the primary domain will be used 
$new->data['softdirectory'] = 'folder'; // OPTIONAL - By default it will be installed in the /public_html folder 
$new->data['admin_pass'] = 'qwerty'; 
$new->data['admin_email'] = 'admin@domain.com'; 
$res = $new->install(26); // Will install WordPress 
if($res == 'installed'){
   echo 'Installed'; 
}else{
   echo $res; // A serialized array of error will be returned
} 

As you may see this will install WordPress.
Lets go through the Code :

Initializing and Authentication

$new = new Soft_Install();
$new->login = 'http://user:password@domain.com:2002/index.php'; 

This will load the Class in $new and we are setting the LOGIN URL as without authentication you will not be able to access Webuzo. Webuzo allows User Authentication via the URL itself.

http://user:password@domain.com:2002

NOTE : This is the URL which is used to install ANY Script. Hence it is very important to install any script.

Dont send emails

If you want no emails to be sent by Webuzo on the installation of a script please pass the &noemail=1& in the login url. e.g :

$new->login = 'http://user:password@domain.com:2002/index.php?&noemail=1&';

Data Fields

Webuzo will expect you to submit the data fields as it shows during the installation of Scripts. Now most scripts have common fields like Admin Username and Password and stuff like that. The values that you pass for the fields in this API Call will replace the default ones shown in Webuzo. If you don't specify any field the default value is used by Webuzo.

$new->data['softdomain'] = 'domain.com'; // OPTIONAL - By Default the primary domain will be used 
$new->data['softdirectory'] = 'folder'; // OPTIONAL - By default it will be installed in the /public_html folder 
$new->data['admin_pass'] = 'qwerty'; 
$new->data['admin_email'] = 'admin@domain.com'; 
$res = $new->install(26); // Will install WordPress 

The above code is just setting the Domain, Folder to install in, Admin Password and Admin Email.
The field names for each script can be obtained from the install.xml file of the script. Eg: /var/softaculous/wp/install.xml
The line $res = $new->install(26); will start the installation process and $res will have the result that is obtained.

Return Values

if($res == 'installed'){ 
   echo 'Installed'; 
}else{ 
   echo $res; // A serialized array of error will be returned 
} 

On a successful install $res will have the value installed
On error a SERIALIZED PHP ARRAY is returned with the error details.

Support

You can always ask us if you have any queries. The support department can be accessed from here : https://www.softaculous.net/support/

    Was this page helpful?
    Newsletter Subscription
    Subscribing you to the mailing list