Zubrag.com
September 20, 2018, 03:13:44 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: create database  (Read 8773 times)
prestonm
Newbie
*
Posts: 6


« 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

Logged
prestonm
Newbie
*
Posts: 6


« Reply #1 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=******
Logged
zubrag
Administrator
Hero Member
*****
Posts: 788


WWW
« Reply #2 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.
Logged
ahrasis
Newbie
*
Posts: 3


« Reply #3 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?
Logged
Markspixel.com
Newbie
*
Posts: 2


« Reply #4 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?
Logged
Markspixel.com
Newbie
*
Posts: 2


« Reply #5 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.
Logged
Aanatra
Newbie
*
Posts: 1


« Reply #6 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)
Logged
zubrag
Administrator
Hero Member
*****
Posts: 788


WWW
« Reply #7 on: October 28, 2010, 03:02:41 AM »

thanks for sharing
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC