The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

PHP Plugin not loading page...

Discussion in 'cPanel Developers' started by hirani89, Feb 10, 2015.

  1. hirani89

    hirani89 Registered

    Joined:
    Feb 10, 2015
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    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 -
     
    #1 hirani89, Feb 10, 2015
    Last edited by a moderator: Feb 11, 2015
  2. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,451
    Likes Received:
    195
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    You'll need to do the troubleshooting yourself and if you run into a specific problem using the cPanel API, post about that specifically here for possible assistance.
     
  3. hirani89

    hirani89 Registered

    Joined:
    Feb 10, 2015
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    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'));  
    			
    			}
    ?>
     
Loading...

Share This Page