我正在尝试使用cpanel xmlapi创建mysql数据库。 在google上搜索后,我找到了以下代码。
$auth_user = 'XXXXXX';
$auth_pass = 'XXXXX';
$server = 'XXXXXXXX.com';
$json_client = new \xmlapi($server);
$json_client->set_output('json');
$json_client->set_port(2083);
$json_client->password_auth($auth_user, $auth_pass);
$json_client->set_debug(1);
# Create Database
$result = $json_client->api1_query($auth_user, 'Mysql', 'adddb',array($shop->alias));
var_dump($result);
运行此代码后出现此错误:
string(202) "{"cpanelresult":{"apiversion":"2","error":"The “cpanel_jsonapi_module†parameter is required.","data":{"reason":"The “cpanel_jsonapi_module†parameter is required.","result":"0"},"type":"text"}}"