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.

cPanel API 2 add addon domain error

Discussion in 'cPanel Developers' started by Ardi Asllani, Jan 17, 2016.

  1. Ardi Asllani

    Ardi Asllani Registered

    Joined:
    Jan 17, 2016
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    USA
    cPanel Access Level:
    Website Owner
    Hello, i am having a problem when i try to add a addon domain, when i try it it gives me a error. All other APIs functions work only this one doesn't. Here is my code and error.

    PHP Code:

    PHP:
    function test_api() {

        global 
    $cpanelhost;
        global 
    $cpaneluser;
        global 
    $cpanelpass;

        
    $xmlapi = new xmlapi($cpanelhost);   
        
    $xmlapi->password_auth("".$cpaneluser."","".$cpanelpass."");   
        
    $xmlapi->set_port(2082);
        
    $xmlapi->set_debug(1);
        
    $xmlapi->set_output('array');

        
    $add_domain $xmlapi->api2_query($cpaneluser'AddonDomain''addaddondomain', array('dir' => 'public_html/shikoshkarko''newdomain' => 'shikoshkarko.com''subdomain' => 'shikoshkarko.ideviceblog.org'));
       
        
    print_r($add_domain);
       
        echo 
    '<br />';
        if(
    $add_domain[data][result] == 1){
            echo 
    $add_domain[data][reason].'<br />';
        } else {
            echo 
    $add_domain[data][reason].'<br />';
        }
    }
    Error:
    Array ( [apiversion] => 1 [error] => “/usr/local/cpanel/cpanel” exited with status 2 (ENOENT). [data] => Array ( [result] => 0 [reason] => “/usr/local/cpanel/cpanel” exited with status 2 (ENOENT). ) )
     
  2. JaredE

    JaredE Registered

    Joined:
    Jan 20, 2016
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    United States
    cPanel Access Level:
    Website Owner
    I'm having the same issue on my shared hosting account, and I think it may be disabled by them. I'm also getting in the response that the apiversion is 1, when it normally returns as 2, and we're calling api2_query. If you find any direction will you please post it here? I'll do the same
     
  3. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,723
    Likes Received:
    660
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    The subdomain entry should read as "shikoshkarko" in the example you provided instead of using the full subdomain. I'm unable to reproduce this issue on a test server. Do you have root access to the system?

    Thank you.
     
  4. JaredE

    JaredE Registered

    Joined:
    Jan 20, 2016
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    United States
    cPanel Access Level:
    Website Owner
    I've tried changing the subdomain to just the name itself and that returns the same error message. I have tried switching to json output, which does return that the apiversion equals 2, but the same error. My Cpanel version is 11.48.5 and I do not have root access. I do not have permission to view /usr/local/cpanel/ or any of cpanels error logs
     
  5. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,723
    Likes Received:
    660
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Have you reported the issue to your web hosting provider so they can take a closer look? Note that cPanel version 11.48 is close to end-of-life:

    11.48 to EOL in 2 Months | cPanel Newsroom

    Thank you.
     
  6. Ardi Asllani

    Ardi Asllani Registered

    Joined:
    Jan 17, 2016
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    USA
    cPanel Access Level:
    Website Owner
    I did the same thing but it shows the same error like @JaredE, I am going to report the issue to my host provider right now and let you guys know.
     
  7. Ardi Asllani

    Ardi Asllani Registered

    Joined:
    Jan 17, 2016
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    USA
    cPanel Access Level:
    Website Owner
    I contacted my host provider and i told him what was the problem, they said that 'You need permission', 'Ask the owner for access'. What does this mean??
     
  8. JaredE

    JaredE Registered

    Joined:
    Jan 20, 2016
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    United States
    cPanel Access Level:
    Website Owner
    My hosting provider said the function was disabled but that it may become available later, and that it was scheduled for upgrade.
     
  9. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,723
    Likes Received:
    660
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
  10. Ardi Asllani

    Ardi Asllani Registered

    Joined:
    Jan 17, 2016
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    USA
    cPanel Access Level:
    Website Owner
    It works fine when i add a addon domain through cPanel
     
  11. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,723
    Likes Received:
    660
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Assuming you don't have root access to the server, and it's on version 11.48, please provide your hosting provider with the following URL to let them know version 11.48 is EOL:

    cPanel & WHM Now 11.48 | cPanel Newsroom

    Thank you.
     
Loading...

Share This Page