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!

Error removing subdomain

Discussion in 'cPanel Developers' started by webiliza, Sep 19, 2018.

Tags:
  1. webiliza

    webiliza Registered

    Joined:
    Aug 6, 2018
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Brasil
    cPanel Access Level:
    Root Administrator
    I use the API by calling the function:
    PHP:
    $cPanel = new cpanelAPI($cpaneluser$cpanelpass'maindomain.com');
    $response $cPanel->api2->SubDomain->delsubdomain(['domain' => 'mysubtest.domain.com']);
    returns error:
    Code:
    [QUOTE]Failed to find the domain(s): “mysubtest.domain.com.maindomain.com”. at /usr/local/cpanel/Cpanel/PHP/Config.pm line 255. Cpanel::PHP::Config::_get_php_config_for_domains(0, ARRAY(0x2ff8450)) called at /usr/local/cpanel/Cpanel/PHP/Config.pm line 275 Cpanel::PHP::Config::get_php_config_for_domains(ARRAY(0x2ff8450)) called at /usr/local/cpanel/Cpanel/PHPFPM.pm line 877 Cpanel::PHPFPM::_removedomain("mysubtest.domain.com.maindomain.com") called at /usr/local/cpanel/Cpanel/Sub.pm line 544 Cpanel::Sub::delsubdomain(__CPANEL_HIDDEN__, __CPANEL_HIDDEN__, __CPANEL_HIDDEN__, __CPANEL_HIDDEN__, __CPANEL_HIDDEN__, __CPANEL_HIDDEN__, __CPANEL_HIDDEN__, 0, ...) called at bin/admin/Cpanel/domain.pl line 227 bin::admin::Cpanel::domain::__ANON__() called at /usr/local/cpanel/3rdparty/perl/526/lib64/perl5/cpanel_lib/Try/Tiny.pm line 95 eval {...} called at /usr/local/cpanel/3rdparty/perl/526/lib64/perl5/cpanel_lib/Try/Tiny.pm line 90 Try::Tiny::try(CODE(0x2e95aa8), Try::Tiny::Catch=REF(0x124c030)) called at bin/admin/Cpanel/domain.pl line 231 bin::admin::Cpanel::domain::script("bin::admin::Cpanel::domain") called at bin/admin/Cpanel/domain.pl line 41[/QUOTE]
    
    It seems to me that the function is joining the subdomain with the main domain and trying to remove "mysubtest.domain.com.maindomain.com".

    Would this be a problem with the API or a bug with my function?

    Can someone help me?
     
    #1 webiliza, Sep 19, 2018
    Last edited by a moderator: Sep 19, 2018
  2. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,802
    Likes Received:
    1,896
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello @webiliza,

    It looks like you are using a dot instead of an underscore for the subdomain. Underscores should be used in place of dots when deleting the subdomain of an addon domain. See the following quote from our cPanel API 2 documentation:

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

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