We are trying to create database through api 2. but we can't acheieve it. How do we require the class Cpanel .
Here is our tried code. but didnt work.
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
$database = 'exampl_db';
$create_database = $cpanel->api2(
'MysqlFE', 'createdb',
array(
'db' => $database,
)
);
if($create_database == 1) {
$grant_user = $cpanel->api2(
'MysqlFE', 'setdbuserprivileges',
array(
'privileges' => 'ALL PRIVILEGES',
'db' => $database,
'dbuser' => 'username',
)
);
and we got this error " Fatal error: Uncaught Error: Class 'CPANEL' not found in" So we tried to require the cpanel program.
require_once "/usr/local/cpanel/php/cpanel.php"; on the same file
Here is our tried code. but didnt work.
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
$database = 'exampl_db';
$create_database = $cpanel->api2(
'MysqlFE', 'createdb',
array(
'db' => $database,
)
);
if($create_database == 1) {
$grant_user = $cpanel->api2(
'MysqlFE', 'setdbuserprivileges',
array(
'privileges' => 'ALL PRIVILEGES',
'db' => $database,
'dbuser' => 'username',
)
);
and we got this error " Fatal error: Uncaught Error: Class 'CPANEL' not found in" So we tried to require the cpanel program.
require_once "/usr/local/cpanel/php/cpanel.php"; on the same file