Reputation: 1
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
Upvotes: 0
Views: 525
Reputation: 377
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
Upvotes: 0