v-add-database command not working
Posted: Tue Dec 10, 2019 12:47 pm
Hello.
I'm tring to integrate vesta panel my cms. But I can't create db for each user.
I always getting false error message. what the reason can be?
I'm tring to integrate vesta panel my cms. But I can't create db for each user.
Code: Select all
$dbvars = array(
'user' => $vst_username,
'password' => $vst_password,
'returncode' => 'yes',
'cmd' => 'v-add-database',
'arg1' => $vesta_username,
'arg2' => $site_database,
'arg3' => $site_db_user,
'arg4' => $site_db_pass
);
$dbdata = http_build_query($dbvars);
$db_curl = curl_init();
curl_setopt($db_curl, CURLOPT_URL, 'https://' . $vst_hostname . ':8083/api/');
curl_setopt($db_curl, CURLOPT_RETURNTRANSFER,true);
curl_setopt($db_curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($db_curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($db_curl, CURLOPT_POST, true);
curl_setopt($db_curl, CURLOPT_POSTFIELDS, $dbdata);
$db_answer = curl_exec($db_curl);
if($db_answer == 0) {
echo "ok";
} else {
echo "false";
}