【问题标题】:Create database dynamically in cpanel using xmlapi使用xmlapi在cpanel中动态创建数据库
【发布时间】:2017-03-17 00:59:19
【问题描述】:

我在 php 脚本中使用 xmlapi 在 cpanel 中创建动态数据库我收到此错误

致命错误:未捕获的异常 'Exception' 带有消息 'curl_exec 抛出错误“无法连接到 mangalaisai.com 端口 2083: 连接超时

请大家帮帮我

【问题讨论】:

  • 欢迎来到 StackOverflow!为了给您一个很好的答案,如果您还没有看过how to ask a good question,或者查看tour,它可能会对我们有所帮助。

标签: php cpanel cpanel-xmlapi


【解决方案1】:

要使用 cpanel api 生成动态数据库,您可以使用以下

        $api2args = array(
            'db'=>$firstlabel.$dbname, // first label will be db label 
        );

        //create new db in the cpanel
        $result = $xmlapi->api2_query($username, 'MysqlFE', 'createdb', $api2args);

如果您无法连接 cpanel api 与 mangalaisai.com ,您可以使用域名为 cpanel.mangalaisai.com 或通过 ftp 连接您可以使用 ftp.mangalaisai.com ,这些域将很容易使用 cpanel api 连接,也也有助于连接 Cloudflare 域。

连接超时也可以解决如下:-

   curl_setopt($ch, CURLOPT_CONNECTTIMEOUT ,0); 
   curl_setopt($ch, CURLOPT_TIMEOUT, 400); //timeout in seconds

还在php.ini文件中设置时间限制如下(php.ini可以在public_html目录下找到)

   set_time_limit(0);// to infinity for example

【讨论】:

    猜你喜欢
    • 2013-01-18
    • 2019-07-26
    • 2022-01-10
    • 2013-07-24
    • 1970-01-01
    • 2016-02-22
    • 1970-01-01
    • 1970-01-01
    • 2016-03-22
    相关资源
    最近更新 更多