0

I am using xmlapi in php script to create dynamic database in cpanel i'm getting this error

Fatal error: Uncaught exception 'Exception' with message 'curl_exec threw error "Failed to connect to mangalaisai.com port 2083: Connection timed out

Anyone Please help me

ArK
  • 20,698
  • 67
  • 109
  • 136
  • 2
    Welcome to StackOverflow! To give you a great answer, it might help us if you have a glance at [how to ask a good question](http://stackoverflow.com/help/how-to-ask) if you haven't already or check out the [tour]. – Henders Nov 03 '16 at 12:32

1 Answers1

0

To generate a dynamic database using cpanel api , you can use following

        $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);

if you are unable to connect cpanel api with mangalaisai.com , you can use domain names as cpanel.mangalaisai.com or with ftp connection you can use ftp.mangalaisai.com , these domain will easily connect using cpanel api and also helpful to connect with Cloudflare domains too.

also connection time out can be resolved as below:-

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

also set time limit in php.ini file as below (php.ini can found under public_html dir)

   set_time_limit(0);// to infinity for example
jagjeet
  • 376
  • 4
  • 12