Zubrag.com :: Forum

zubrag.com => cPanel Scripts => Topic started by: prestonm on August 13, 2010, 01:16:58 PM



Title: create database
Post by: prestonm on August 13, 2010, 01:16:58 PM
Running this script:

http://example.com/sites/all/files/cpanel_create_db.php?db=examplecom_1016&user=examplecom_example&pass=hrxp5_2

Produced:

[function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /home/.../cpanel_create_db.php on line 43
cPanel 11
MySQL Users

This appears to refer to the curl path which is /usr/bin/curl on my server.

Inserting /usr/bin/curl in line 30 produced a blank screen (no error message) but no database.

Question: Should this script be expected create databases in subdomains?
i.e.:
examplecom_1016
examplecom_1017
examplecom_1018

In the site example.com?

Thanks, Prestonm


Title: Re: create database
Post by: prestonm on August 14, 2010, 08:35:03 AM
I'll stay with this until I get it working. Must be close. cpanel_create_db.php is located in both the files and root directories. Execution is instant but no db is created. "example_" is required by the hosting company as a prefix for both database and user.

Can anyone see an error?

All three of these examples end with this message:
cPanel 11
MySQL Users
Added user example_bps6 with the password ******.

http://example.com/sites/all/files/cpanel_create_db.php?db=example_1022
http://example.com/cpanel_create_db.php?db=example_1023&user=example_bps6&pass=******
http://example.com/cpanel_create_db.php?db=1024&user=example_bps6&pass=******


Title: Re: create database
Post by: zubrag on August 16, 2010, 03:26:28 AM
It was written for earlier cPanel versions. Unfortunately never been tested on cPanel 11. Could be these scripts are not compatible with cPanel 11. From your error message it looks like that.


Title: Re: create database
Post by: ahrasis on August 17, 2010, 05:41:10 AM
Hi, I just join and I am also looking on how to make this script work with cpanel 11. Is there any other way?


Title: Re: create database
Post by: Markspixel.com on September 10, 2010, 11:49:58 PM
Hey guys I am running Cpanel 11.26 and it seems to work fine for me with one exception

I keep getting this error: 'newdb' is an invalid Database name.

Could it be the quotes?

How do i remove them?


Title: Re: create database
Post by: Markspixel.com on September 10, 2010, 11:52:43 PM
change:

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

to:

Code:
$db_name = $_GET['db'];

And it seems to work for me perfectly.

Thanks and good script.


Title: Re: create database
Post by: Aanatra on October 28, 2010, 12:15:19 AM
Thanks for the script! It works on my cPanel 11.26.9 with some changes.

As mentionned above:

Code:
$db_name = $_GET['db'];

and:

Code:
$result = execCommand("http://$cpanel_user:$cpanel_password@$cpanel_host:2082/frontend/$cpanel_skin/sql/addb.html?db=$db_name");
where it should be only 'addb.html' instead of 'adddb.html'

BTW, with my cPanel, I had to set $cpanel_skin = "x3";  (they call that a Theme rather than a skin)


Title: Re: create database
Post by: zubrag on October 28, 2010, 03:02:41 AM
thanks for sharing