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!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

AddonDomain::addaddondomain API 2 PHP non-resolving domains

Discussion in 'cPanel Developers' started by htmldesign, Oct 29, 2015.

  1. htmldesign

    htmldesign Member

    Oct 29, 2015
    Likes Received:
    Trophy Points:
    cPanel Access Level:
    Root Administrator
    Hi Cpanel Community.
    Apologies on advance if this was ever addressed, I've searched everywhere on the forum and couldnt find a similar problem.
    I manage close to 11000 (eleven k) domains under a VPS hosting account (with root WHM and cpanel ). Im not a reseller, just a large domain portfolio care taker.
    Due to the large number of domains, I took the direction of implementing a tool-box that
    allows simple queries ( list email, list subdomains, ... ) and also it allows SubDomain creation,
    Batch SubDomain Creation, Email boxes creation/delete, Subdomain Delegation ( A Record ) -
    everything is working fine except with the addaddondomain.
    When I add ( via API 2 and php ) an add on domain, the domain is created, a subdomain
    of the main domain is also created, and the result message is success "Add On domain successfully parked on .. " however, only the subdomain+maindomain resolves, the actual addon domain doesnt. Here's the flow in detail:

    -via php ( xml-api.php - api2 )

    -array arg$ is 'dir', 'newdomain' and 'subdomain'

    For example:
    main domain:
    Add On Domain to be added:

    so the arg$ value becomes
    newdomain =
    subdomain = maindomaincom
    dir = /public_html/anotherdomain

    The result is:

    but, doesnt resolve ( as in not live )

    -I noticed that the DNS Zone for is created and visible in WHM but
    it is not visible from Cpanel's Zone Edit.
    -the DNS record of the appears OK ( in WHM ) - doesnt show in cpanel.

    -im authenticating using the cpanel user ( i tried root but same result )

    -the subdomain is present in Cpanel ( under the accordingly user used in the api call ) 's Subdomains page .. ( but not in Dns Edit - only on dns edit at WHM )

    i have been fighting with this for 4 days now.


    -When I use addaddondomain, it should show in both cpanel and whm, right ?
    -what is the serial # on the whm edit zone page ?
    -Am I supposed to handle the DNS part as well ? ( addZone ) ? I am under
    the impression that the api covers it all, or am I mistaken ?
    -The Park/Unpark Main Domain/Subdomain relation seemed clear to me, but now
    after days, im getting confused for real.
    What am I doing wrong ? really appreciative if someone could help me out.

    below is the excerpt from my code:
    $cpaneluser = 'cpaneluser'
    $password = 'password';
    $box =
    $client = new xmlapi($box);
    $client->password_auth($cpaneluser, $password );

    $arg$ = array ('dir' => $dir, 'newdomain' => $domain, 'subdomain' => $trimmeddomain );
    $resp = $client->api2_query ( $cpaneluser, 'AddonDomain', 'addaddondomain', $arraydata );

    thanks in advance for anyone willing to save me.


    ps: I did play with the domain tweaks ( whm ) but without any further success.

    ps2: I realize the above code needs to be highlighted in a special format here in the thread, but I couldnt find the option, apologies.
  2. cPDavidN

    cPDavidN cPanel Developer
    Staff Member

    Mar 19, 2013
    Likes Received:
    Trophy Points:
    cPanel Access Level:
    DataCenter Provider

    Thanks for contacting us. The behavior you're describing isn't intended, but I'm not aware of any other instances like this. Could you open a support ticket so we can investigate this specific instance in better detail?


    David Nielson
    Integration Developer, cPanel
    htmldesign likes this.
  3. htmldesign

    htmldesign Member

    Oct 29, 2015
    Likes Received:
    Trophy Points:
    cPanel Access Level:
    Root Administrator
    Hi David, thanks for your reply.
    I finally managed to fix it and the description is a bit complex, to summarize: I believe there is a problem with certain new top level domains (nGTLDs ) that might cause trouble on the resolving of a tertiary name server. I believe it is related to the resolving of A Records when one uses more than two nameservers AND delegated subdomains, for instance:

    SLD.TLD -> authoritative or parent at the Registrar level as ns1.sld.tld, ns2.sld.tld and (please note tertiary is not mandatory ) ns3.sld.tld
    on my side ( non-shared, VPS, cpanel, whm ) matching name and proper SOA ns1.sld.tld ns2.sld.tld .. ns3.sld.tld
    please also note im not using the hosting provider's nameservers but rather pointing to my own custom ( same server though, extra A record - but needed for my digitial asset mgmt platform, which is custom ).

    If I dont use a tertiary then AddonDomain::addaddondomain works ok, and new addon domain resolves properly.

    If I use a tertiary, then the AddonDomain::addaddondomain works ok, that is the result seems ok, dir created, appears in
    WHM ( but not in cpanel ) AND does *not* resolve.

    to make it even more complex, it seems to apply to certain .tlds only. ( please also note im not using any ccTLD on this test .. yet )

    in order to make the faulty one ( domain ) under the tertiary context to work, I have to wipe the tertiary from the dns zone (
    in WHM or via API ( ::fetchzone, find line # then ::editfileZone and finally resetFileZone -or synch records via whm , if I re-add
    it manually ( via the GUI, whm that is ) the tertiary record, then it resolves.

    The leftover of this context, for the faulty ones, it doesnt show in cpanel ( but it does in whm ) which also creates trouble
    to remove the domain ( manually or via API ) ...

    the workaround works, as a final note, it is important to add that most of the domains Im using have a need of delegation,
    that is: NameServer under whm but main domain resolves somewhere else, subdomain1 resolves local, subdomain2...
    example: ( dot link is a newGTLD )
    NS in same server as WHM and cpanel, but A record of will resolve somewhere else. [ somewhere else, and not the same as previous ]
    geoLocation2........ sometimes up to 7 subdomains.
  4. htmldesign

    htmldesign Member

    Oct 29, 2015
    Likes Received:
    Trophy Points:
    cPanel Access Level:
    Root Administrator
    FYI, I think this problem is related to the fact that new gTLDs require a different validation anywhere where there is
    a verification of the domain validity, for example, domains like or, can cause domain validation
    to fail in some contexts ( such as email validation, and alikes seems to irritate countless contact forms throughout the Internet ), in this specific case the workaround I found was to add tertiary nameserver using "normal gTLDs" such as .com will allow an update to work. ex: if you want to add a tertiary NS and pass all the validations, just use a .com or .net, allow the synchronization ( all dnszones + multi cluster ) and then once it is in the whm DnsZone, use the api ZoneEdit::fetchzones to get the line # of the specific DnsZone DNS record, and then ZoneEdit::edit_zone_report and re-synch zones.
Similar Threads - AddonDomain addaddondomain resolving
  1. durangod

Share This Page