cPanel db Creator script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I hope I am doing this write as this is the first time I've sent a message to a mailing list!

I have a php script that uses cPanel to create a database.  It requires the cURL to be installed and my webhost has confirmed to me that it is installed.

I have not been able to get the script to work and so emailed my webhost for help.  Their reply was "You may need to configure your script to use PHP's built-in cURL function in order to get this to work instead of the CLI cURL."

Now, I am not well experienced yet but am learning fast.  This is the first time I've come across cURL so I am at a complete loss and wondered if someone could help me with this.  Here's the script I have.

<?php

// cPanel username

$cpanel_user = "******";

// cPanel password

$cpanel_password = "******";

// cPanel host

$cpanel_host = "*******";

// cPanel theme/skin, usually "x"

$cpanel_skin = "x";

$db_name = "testing";

// Path to cURL on your server

$curl_path = "/usr/bin/curl";

//////////////////////////////////////

/* Code below should not be changed */

//////////////////////////////////////

if(isset($_GET['db']) && !empty($_GET['db'])) {

// escape db name

$db_name = escapeshellarg($_GET['db']);

// will return empty string on success, error message on error

$result = exec("$curl_path 'http://$cpanel_user:$cpanel_password@$cpanel_host:2082/frontend/$cpanel_skin/sql/adddb.html?db=$db_name'");

// output result

echo $ch;

}

else {

echo "Usage: cpanel_create_db.php?db=$db_name";

}

?>

Thanks in advance to anyone who has a clue how to solve this!!!

Paul.

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux