hirani89

Registered
Feb 10, 2015
4
0
1
cPanel Access Level
Root Administrator
Need help from anyone who can help...

I'm building a plugin which will help our company and the general public to install a custom wordpress installation.

At the company, there are a limited number of themes that we use. And a few combination of plugins depending on the type of website.

Using the built-in Site Builder plugin from WHM is good. But then it takes us a fair bit of time to add all the plugins and themes and activating them. Then delete the sample posts and unwanted plugins.

I've built the script to create the database and install themes and plugins. It all works in local development (MAMP) but the same script uploaded to cpanel doesn't work.

I've tested that the plugin has been successfully installed. I replaced the PHP script with simple html and it worked.

The plugin can be download from here: - Removed -
 
Last edited by a moderator:

hirani89

Registered
Feb 10, 2015
4
0
1
cPanel Access Level
Root Administrator
I think the main problem here is creating the database.

I used the code below to test database creation. But same problem... Nothing happens on the page and no database is created either...

Code:
<?php 
		include("xmlapi.php");  
		$db_host = "localhost";  
			$cpuser = "root";  
			$databasename = 'testwp';//do not prepend with username
			$databaseuser = 'hirani001'//api will do that for you
			$databasepass = 'hirani';
			
			$xmlapi = new xmlapi($db_host);  
			$xmlapi->password_auth("root","cei9jeeTi9Aehash");  
			$xmlapi->set_debug(1);//this setting will put output into the error log in the directory that you are calling script from 
			$xmlapi->set_output('array');//set this for browser output
			//create database  
			$createdb = $xmlapi->api1_query($cpuser, "Mysql", "adddb", array($databasename)); 
			foreach($createdb as $v)
			{
			    $result = $v['result'];
			}
			if ($result == 1)
			{
			    //create user  
			    $usr = $xmlapi->api1_query($cpuser, "Mysql", "adduser", array($databaseuser, $databasepass));  
			}
			foreach($usr as $v)
			{
			    $result2 = $v['result'];
			}
			if ($result2 == 1)
			{
			    //add user to database  
			    $addusr = $xmlapi->api1_query($cpuser, "Mysql", "adduserdb", array($databasename, $databaseuser, 'all'));  
			
			}
?>