Cpanel API Database Creation with out root access

前提是你 提交于 2019-12-11 20:43:37

问题


So I'm trying to create a database/user with out root access. It's either not possible - or i've done something wrong.

Suggestions? Missing a Step?

Here is my code as of now:

include("xmlapi.php");   
$xmlapi = new xmlapi($db_host);    
$xmlapi->password_auth("".$cpaneluser."","".$cpanelpass."");    
$xmlapi->set_debug(1);//output actions in the error log 1 for true and 0 false  
$xmlapi->set_output('array');//set this for browser output  
//create database    
$createdb = $xmlapi->api1_query($cpaneluser, "Mysql", "adddb", array($databasename));   
//create user 
$usr = $xmlapi->api1_query($cpaneluser, "Mysql", "adduser", array($databaseuser, $databasepass));   
 //add user 
$addusr = $xmlapi->api1_query($cpaneluser, "Mysql", "adduserdb", array("".$cpaneluser."_".$databasename."", "".$cpaneluser."_".$databaseuser."", 'all'));  

Doing a print_r of any of the calls just tells me Array ( [data] => Array ( [result] => 0 [reason] => Access denied )


回答1:


Actually the solution here is to do this:

$xmlapi->set_port( 2083 );

You don't need to disable SSL through WHM, that's not ideal.




回答2:


So I'm trying to create a database/user with out root access

Unless the user you are logging in with has permission to create new databases or users, then you will not be able to accomplish this.

This is true whether we're talking about the CPanel API or MySQL itself.




回答3:


There was a setting in whm only allowing ssl connections. Turned it off and worked fine.



来源:https://stackoverflow.com/questions/5608010/cpanel-api-database-creation-with-out-root-access

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!