Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

AddonDomains module help

Discussion in 'cPanel Developers' started by hron84, Feb 5, 2011.

  1. hron84

    hron84 Member

    Feb 5, 2011
    Likes Received:
    Trophy Points:

    I trying migrate our hosting to CPanel, and I ran into a small understanding problems.

    In AddonDomain::addaddondomain call has 3 parameter:
    - newdomain
    - subdomain
    - dir

    Say, user have as its 'main' domain, but it want add as 'addon domain', then i fill these parameters with:
    - newdomain:
    - subdomain: simpledomain
    - dir: public_html/

    Is this correct? Or I understand something wrong?

    I tried add another domain, and I got following:
    Removed Server at line: 435.
    Removed Entry from httpd.conf
    Bind reloading on cloudlinux using rndc zone: []
    The subdomain, has been removed.
    The parameters was:
    - dir: public_html/
    - newdomain:
    - subdomain: somedomain

    And the new domain didn't appeared on Cpanel interface (server:2083). But the return values says it was a successful transaction (result: 1)... or I misunderstand something? :confused:

    Please help me...
  2. cPanelTristan

    cPanelTristan Quality Assurance Analyst Staff Member

    Oct 2, 2010
    Likes Received:
    Trophy Points:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    Hello hron84,

    Could you provide the full API call you used for adding the domain? Also, the example you noted for adding the domain shows a removal rather than adding a domain here:

    Are you certain you provided the correct output from when you ran the API call?

    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. cPanelDavidN

    cPanelDavidN Integration Developer

    Dec 17, 2009
    Likes Received:
    Trophy Points:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Hi hron84,

    1) yes, your parameters are correct.

    2) yes, it's possible to receive that error message from the AddonDomain::addaddondomain call
    2.a) yes it's possible to receive a '1' in the result (indicating success) on an "error" event such as this.

    Now for a little more detail about item #2 above.

    Firstly, I'm not sure what level of access you have to your cPanel box, but if you have privileged access, such as root, you can look at the cPanel error log (/usr/local/cpanel/logs/error_log) and sometime get more info. In this case, the issue becomes very clear because there IS info in the log.

    I'll step through the whole scenario, just to be clear. I use the PHP XML-API class to make my API calls, but you can essentially do all the same function calls in other methods.

    1) So I make this script

    $ip "";
    $root_pass "root_secret!";
    $url '';
    $sub 'where';

    $xmlapi = new xmlapi($ip);

    // setup authentication as root

    // or as user
    //$xmlapi->password_auth($user, $upass);

    // for debugging

    $args = array(
    'newdomain'    =>$url,
    'dir'        =>"'public_html/$url",
    'subdomain' =>$sub,
    2) the the call and response
    [David-N:~/xmlapi] $ php -f addondomain_test.php 
     <?xml version="1.0" ?>
          <reason>Deleted domain: where.dave.test
    Bind reloading on david using rndc zone: [dave.test]
    The subdomain, where.dave.test has been removed.</reason>
    3) Okay, so I obviously got the same result as you...essential it's this data:
    $VAR1 = [
                'reason' => 'Deleted domain: where.dave.test
    Bind reloading on david using rndc zone: [dave.test]
    The subdomain, where.dave.test has been removed.',
                'result' => 1
    A)The reason is totally not related to what we are's talking about deleting domains
    B) the result is "1" though we can check the cPanel interface and it's obviously not there

    4) So let's look at error log
    [2011-02-07 08:20:52 -0600] warn [addondomain::addaddondomain] Encountered error in addondomain::addaddondomain: Error from park wrapper: Using nameservers with the following IPs:,,,,
    Sorry, the domain is already pointed to an IP address that does not appear to use DNS servers associated with this server. Please transfer the domain to this servers nameservers or have your administrator add one of its nameservers to /etc/ips.remotedns and make the proper A entries on that remote nameserver.
    PERFECT! The internals for the "addaddondomain" function are complaining! ....something about where the current DNS record for the new domain is pointed. That kind makes some sense, since I didn't ensure that "" was pointed to my cPanel DNS

    5) So if we look at the "reason" again, it's talking about removing/altering DNS records. So, what must be happening is that cPanel is updating it's DNS first, then trying to validate it with a lookup.

    6) The lookup fails the code has to undo what it just did: it internally makes a DNS record deletion API call, whose returned data is considered (by the code) as the proper response to aggregate back to the client.

    7) So, the "1" result is related to the reason, which is related to the clean-up of the actual "addaddondomain" request.

    kinda of lack-luster. However, I don't think this is a change in behavior with new versions of cPanel. I think that this has been the way that AddDomain::addaddondomain has worked for a long time. I will do some more investigation just to double check.

    Now, if I where to make the same call with a domain name that DID point correctly, or just a domain that did exist
    $url 'jlaoiaouweenrw.test';
    I should see a success message
          <reason>jlaoiaouweenrw.test was successfully parked on top of where.dave.test</reason>
    Best Regards,
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice