我正在尝试从我的网站CMS动态创建子域名。
我创建了以下脚本: require_once“/usr/local/cpanel/php/cpanel.php”;
$cpanel = new CPANEL();
$get_userdata = $cpanel->uapi(
'DomainInfo', 'domains_data',
array(
'format' => 'hash',
)
);
$addsubdomain = $cpanel->api2(
'SubDomain', 'addsubdomain',
array(
'domain' => ''. $subdomain .'',
'rootdomain' => 'REMOVED',
'dir' => '/public_html/',
'disallowdot' => '1',
)
);
我收到以下错误:
PHP Fatal error: Uncaught exception 'RuntimeException' with message 'There was a problem fetching the env variablecontaining the path to the socket' in /usr/local/cpanel/php/cpanel.php:146
为什么这是我做错了什么?
答案 0 :(得分:0)
当您尝试在cPanel文档根目录之外的PHP脚本中使用LiveAPI时,会出现此错误。
根据cPanel,只能从cPanel的文档根目录/usr/local/cpanel/base/frontend/
,/usr/local/cpanel/base/3rdparty/
中使用LiveAPI。