Monday, June 6, 2016

cPanel Database Creator PHP Script

cPanel php script does not allow you to create databases directly from MySQL/PhpMyAdmin on cPanel webhosting. You would have to login to cPanel and use its interface to create database each time you need a new one.
cPanel Database Creator will make this process much easier. In order to create a database on your hosting server you just need to run this script from browser, shell, or cron job, passing database name as parameter.

Before using this script you will need to update it with cPanel username, password, and host name (domain or IP).

Usage: cpanel_create_db.php?db=database-name&user=username&pass=password
where database-name should be replaced with a database name to be created on your hosting server.
Database Creator will also create a database user and assign it to the database with ALL permissions. Script will not create database user if you omit the user parameter. In this case usage would be cpanel_create_db.php?db=database-name

Note: if script does not work try running it via cURL. This requires cURL installation on the server. Default cURL path is set to /usr/bin/curl. Feel free to change it in the script code if cURL path is different on your hosting server.

Download cPanel Database Creator PHP Script