Welcome Guest. Please Login or Register  


You are here: Index > Softaculous Auto Installer > General Support > Topic : Possible to automate softaculous?



Threaded Mode | Print  

 Possible to automate softaculous? (9 Replies, Read 2997 times)
flycast
Group: Member
Post Group: Newbie
Posts: 6
Status:
I am looking for an inexpensive way to automate the installation of Wordpress upon creating of a new account. I know there is a way to do this using WHMCS but that is overkill for this solution.

Any ideas?
IP: --   

Possible to automate softaculous?
Brijesh
Group: Softaculous Team
Post Group: Super Member
Posts: 5652
Status:
Hi,

You can use the following API to auto install WordPress or any other script :
http://www.softaculous.com/docs/Auto_Install_API

-----------------------
Webuzo - Multi User Hosting Control Panel
AMPPS - Best WordPress/PHP/MySQL development tool
IP: --   

Possible to automate softaculous?
flycast
Group: Member
Post Group: Newbie
Posts: 6
Status:
Hmmm..OK. So it is scriptable. I would need to trigger the script when a new account is created in WHM?
IP: --   

Possible to automate softaculous?
flycast
Group: Member
Post Group: Newbie
Posts: 6
Status:
So, looking into cPanel abilities. It appears that if you create a script called 'postwwwacct' and place it in the folder: /usr/local/cpanel/scripts then when cPanel creates a new account it will run the postwwwacct script. Here is a link to that documentation.

I created the script from some help here.

I am getting an error though. I get:
Quote
Notice: Constant SOFTACULOUS already defined in /usr/local/cpanel/whostmgr/docroot/cgi/softaculous/sdk/installapi.php on line 48


Here is my code:
PHP Code

 @set_time_limit(100);
require_once(
'/usr/local/cpanel/whostmgr/docroot/cgi/softaculous/sdk/installapi.php');

// Setup opts array
$opts = array();
$argv0 array_shift($argv);
while(
count($argv)) {
        
$key array_shift($argv);
        
$value array_shift($argv);
        
$opts[$key] = $value;
}

if (
$opts['plan'] == 'wordpress'){
        
// Setup user
        
$username $opts['user'] . '_wp';
        
$dbname $opts['user'] . '_wp';
        
$pass $opts['pass'];
        
$domain $opts['domain'];
        
$email $opts['contactemail'];
        
        
$new = new Soft_Install();
        
$new->login 'http://'.$username.':'.$pass.'@'.$domain.':2082/frontend/x3/softaculous/index.live.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'] = $pass;
        
$new->data['admin_email'] = $email;
        
$res $new->install(26); // Will install WordPress
         
        
if($res == 'installed'){
          
file_put_contents '/home/aaaa/062560.txt' $res ,FILE_APPEND);
        }else{
          
file_put_contents '/home/aaaa/062560.txt' $res ,FILE_APPEND);
        }




It seems that just requiring that file is wrong. What should I be doing different?
IP: --   

Possible to automate softaculous?
Brijesh
Group: Softaculous Team
Post Group: Super Member
Posts: 5652
Status:
Hi,

Is this "$username" the cPanel user you created ?
Because you are using $username for the $new->login URL and it requires the cPanel user where you want to install the script.

-----------------------
Webuzo - Multi User Hosting Control Panel
AMPPS - Best WordPress/PHP/MySQL development tool
IP: --   

Possible to automate softaculous?
flycast
Group: Member
Post Group: Newbie
Posts: 6
Status:
Yes, it is.

I notice that the code that is displayed on the page that details the Autoinstall information that you reference is in the bottom of intsallapi.php. I am guessing that is most certainly does not belong there???
PHP Code

<?php

function softaculous_scripts(){
//Code removed for brevity
}


class 
Soft_Install{
//Code removed for brevity
}



@
set_time_limit(100);

$new = new Soft_Install();
$new->login 'http://user:password@domain.com:2082/frontend/x3/softaculous/index.live.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';
//$new->data['overwrite_existing'] = true; // Uncomment this line if you wish to overwrite the files and continue installation
// Uncomment the following line if you want to install original package of JS Library (By default JS installaer will install the minimal package)
//$new->data['jsinstalltype'] = 0;  
$res $new->install(26); // Will install WordPress

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

?>



When I remove that code I no longer get the error:
Quote
Notice: Constant SOFTACULOUS already defined in /usr/local/cpanel/whostmgr/docroot/cgi/softaculous/sdk/installapi.php on line 48


Now with the extra code removed when it runs the $res seems to be blank and Wordpress is not installed.
IP: --   

Possible to automate softaculous?
Brijesh
Group: Softaculous Team
Post Group: Super Member
Posts: 5652
Status:
Hi,

Sir the code you removed is required and the installation will not work without that code.

However you need to comment out the following lines in installapi.php :

PHP Code

 @set_time_limit(100);

$new = new Soft_Install();
$new->login 'http://user:password@domain.com:2082/frontend/x3/softaculous/index.live.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';
//$new->data['overwrite_existing'] = true; // Uncomment this line if you wish to overwrite the files and continue installation
// Uncomment the following line if you want to install original package of JS Library (By default JS installaer will install the minimal package)
//$new->data['jsinstalltype'] = 0;  
$res $new->install(26); // Will install WordPress

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




This has been commented in the next version and should not cause the Constant defined error.

Please restore the code you had removed and then try to echo $res.

-----------------------
Webuzo - Multi User Hosting Control Panel
AMPPS - Best WordPress/PHP/MySQL development tool
IP: --   

Possible to automate softaculous?
flycast
Group: Member
Post Group: Newbie
Posts: 6
Status:
Yeah...I just removed the code here for posting so the post wouldn't be too long:

PHP Code

 function softaculous_scripts(){ 
//Code removed for brevity 



class 
Soft_Install
//Code removed for brevity 


IP: --   

Possible to automate softaculous?
Brijesh
Group: Softaculous Team
Post Group: Super Member
Posts: 5652
Status:
Hi,

What output did you get in $res ?

Also is it possible for you create a support ticket with us :
https://www.softaculous.com/support/

-----------------------
Webuzo - Multi User Hosting Control Panel
AMPPS - Best WordPress/PHP/MySQL development tool
IP: --   

Possible to automate softaculous?
flycast
Group: Member
Post Group: Newbie
Posts: 6
Status:
Creating a ticket now.
IP: --   

« Previous    Next »

Threaded Mode | Print  



Jump To :


Users viewing this topic
1 guests, 0 users.


All times are GMT. The time now is April 27, 2024, 4:36 am.

  Powered By AEF 1.0.8 © 2007-2008 Electron Inc.Queries: 11  |  Page Created In:0.027