Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2004
    Posts
    457

    create mysql user/database via php in CPANEL?

    I am trying to create an auto-install script to help users get started with some free software but I am running into a problem with cpanel.

    On a non-paneled host, it's fairly well documented how to create users/databases in mysql via php but on cpanel there is no documentation that I can find? It must be possible as there are commercial scripts that do so. Has anyone see some open public documentation?

    update: aha! helps if you look on php.net
    apparently it's done like this:
    http://USER:[email protected]:2082/frontend/...ddb.html?db=DB
    Last edited by aww; 02-19-2008 at 05:51 AM.

  2. #2
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    563
    Quote Originally Posted by aww View Post
    I am trying to create an auto-install script to help users get started with some free software but I am running into a problem with cpanel.

    On a non-paneled host, it's fairly well documented how to create users/databases in mysql via php but on cpanel there is no documentation that I can find? It must be possible as there are commercial scripts that do so. Has anyone see some open public documentation?

    update: aha! helps if you look on php.net
    apparently it's done like this:
    http://USER[email protected]:2082/frontend/SKIN/sql/adddb.html?db=DB
    If you have root access to the server, you may wish to look at the API code that the theme is actually calling. Themes are typically located in /usr/local/cpanel/base/frontend/SKIN where SKIN is your theme, for example: x3. The X3 theme itself is merely an interface between the user and the underlying cPanel APIs. You may wish to interact directly with the APIs (API1 and API2) via the XML API to ensure that changes in the skin/theme do not affect the functionality of your script.
    David Grega
    cPanel Technical Product Specialist

  3. #3
    Join Date
    Apr 2000
    Location
    California
    Posts
    3,051
    Cpanel doesn't allow a script to create a database or database user for security reasons. As a normal user script owned process, you'll have to code it to either use a wrapper, modify it using the Cpanel API to allow easier script access, and/or you'll have to likely have the script log into the related Cpanel and go through the steps to interact with the existing Cpanel options of creating it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •