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?
|