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!

cPAPI2 This feature is not enabled

Discussion in 'cPanel Developers' started by JAB Creations, Oct 21, 2017.

Tags:
  1. JAB Creations

    JAB Creations Member

    Joined:
    Nov 21, 2009
    Messages:
    17
    Likes Received:
    0
    Trophy Points:
    51
    If I use cpapi2 --user=my_user Park park domain=example.com then I get "reason: This feature is not enabled". How do I enable cpapi2? VPS + root + WHM.
     
  2. sparek-3

    sparek-3 Well-Known Member

    Joined:
    Aug 10, 2002
    Messages:
    1,659
    Likes Received:
    76
    Trophy Points:
    328
    cPanel Access Level:
    Root Administrator
    This is part of the flawed methodology of cPanel.

    my_user has to be using a plan that has a feature list that has parkeddomains enabled.
     
  3. cPAusaf

    cPAusaf Linux Technical Analyst II
    Staff Member

    Joined:
    Aug 24, 2016
    Messages:
    25
    Likes Received:
    1
    Trophy Points:
    78
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    How is it flawed? That particular feature is not enabled for that user and they receive a message stating so.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. sparek-3

    sparek-3 Well-Known Member

    Joined:
    Aug 10, 2002
    Messages:
    1,659
    Likes Received:
    76
    Trophy Points:
    328
    cPanel Access Level:
    Root Administrator
    Because you can park domains on top of an account in the WHM (with root access) but you can't do it through any API call.

    The WHM Park a Domain "feature" doesn't require that the park domain already have it's nameservers set, it doesn't do any domain ownership verification. Which is the way parking a domain was back in cPanel infancy (before parking a domain was available in end user's cPanels).

    But if I'm root and I want to park a domain on top of another account on the server, without regards to domain ownership, the only way to do that is through the WHM. Which means logging into the WHM (which is a pain).

    Why is this "feature" in root's WHM but not available through root's API system?

    The API system you have for cPanel and WHM is great, but it still leaves a bit to be desired. If I can do everything on the server without ever logging into the WHM, that would be my goal. I suppose I'm the minority of 1 that prefers doing everything from shell, but I still prefer doing everything from shell.
     
  5. sparek-3

    sparek-3 Well-Known Member

    Joined:
    Aug 10, 2002
    Messages:
    1,659
    Likes Received:
    76
    Trophy Points:
    328
    cPanel Access Level:
    Root Administrator
    There have been calls for root/WHM level park domain via API in one form or another dating back to at least 2010:

    API2 call 'park' with root permissions

    And it always falls on deaf ears.
     
  6. sparek-3

    sparek-3 Well-Known Member

    Joined:
    Aug 10, 2002
    Messages:
    1,659
    Likes Received:
    76
    Trophy Points:
    328
    cPanel Access Level:
    Root Administrator
    And why we are on the subject of flaws, why is the "feature list" or perhaps more aptly "feature permission" a per package setting? Shouldn't this be a user-level setting?

    By this logic, if I want user1 to have domain parking ability, but I don't want user2 to have domain parking ability. I have to set user1 to a package with a feature list that has domain parking and I have to set user2 to another package that has another feature list that doesn't have domain parking.

    Perhaps I should step down from the soapbox for the rest of the evening.
     
  7. JAB Creations

    JAB Creations Member

    Joined:
    Nov 21, 2009
    Messages:
    17
    Likes Received:
    0
    Trophy Points:
    51
    2017 --> This works!
    cpapi2 --user=username Park park domain=example.com

    On the third post in the thread mentioned by sparek-3 in their third post. I noted that bmett was using cpapi2 and looked up the documentation:
    cPanel API 2 Functions - Park::park - Software Development Kit - cPanel Documentation

    Now there are a couple of very important things to note and cPanel associates should please take in to consideration for refining the documentation.

    1.) I did not know that the subdomain parameter was optional. The first parameter is mentioned as required. There should probably be a dedicated column to help visually differentiate this.

    2.) The username likely will not be root. In example a former host had my user name for cPanel as being jabcre5. I was getting the
    "This feature is not enabled" error while trying to use the root user.

    3.) I always try to scale documentation and I have been a bit confused about how cPanel and WHM relate. I know that obviously if you're a reseller or higher you can have other people with access to their own "copy" of cPanel. This is more in regard to how to check if something is enabled and if an API is not enabled how to enable and even more important what level of permissions you need and how to check what level of permissions you're at. Let's say that there are five levels, 1~5, a feature requires level 3 access and you're level what...? Dead simple and if that information is there I simply do not see it.

    4.) The general overview of the API documentation that lists like five or six versions of different things to do the same stuff (more or less) does not differentiate why one should use one thing over another or if one type of API is more appropriate for a context of a user. Shared, VPS and dedicated in example. It is exceptionally important to use standardized terminology to reduce confusion.

    I will say I'm glad I need to do what I'm doing in 2017 and not ten years ago. There certainly has been a lot of hard work by the cPanel team on implementing support for various features. I think while there is a lot of documentation that the core issues I've mentioned really do the documentation a lot of injustice because once I get something working it works absolutely fantastic. I specialize in UX and human-PC interaction. I'm a power user and if something is prepared properly I can engage quickly and get stuff done. If the cPanel could make those changes to the documentation I think there would be a lot less confusion.

    Thank you for the replies; I appreciate everyone's help and intentions. :)
     
  8. JAB Creations

    JAB Creations Member

    Joined:
    Nov 21, 2009
    Messages:
    17
    Likes Received:
    0
    Trophy Points:
    51
    Well the command executed fine in SSH/PuTTY however it will not run in PHP.

    Code:
    <?php
    echo '1';
    if (!function_exists('shell_exec')) {echo '<p>Can not execute command.</p>';}
    else
    {
     $output = shell_exec('cpapi2 --user=example Park park domain=example.com');
     echo '2';
     echo "<pre>$output</pre>";
     echo '3';
    }
    ?>
    The raw HTML output:

    12<pre></pre>3

    The phpinfo() / disable_functions does not list any functions disabled.

    What am I missing now?
     
    #8 JAB Creations, Oct 22, 2017
    Last edited: Oct 22, 2017
  9. JAB Creations

    JAB Creations Member

    Joined:
    Nov 21, 2009
    Messages:
    17
    Likes Received:
    0
    Trophy Points:
    51
    Solved! Full working answer here!

    I needed the API interface...go figure. I've got it all working now and I'll actually post what I did to save someone else hours of aggravation.

    First use the source code of this file and put it in the same directory you'll be executing the code from:

    xmlapi-php/xmlapi.php at master · CpanelInc/xmlapi-php · GitHub

    Secondly use the following code and simply change the $user and $pass variable values as well as the domain name on the last line.

    Code:
    <?php
    error_reporting(E_ALL);
    ini_set('display_errors', 1);
    include('xmlapi.php');
    $ip = '127.0.0.1';
    $user = 'cpanel_user';
    $pass = 'cpanel_pass';
    $xmlapi = new xmlapi($ip);
    $xmlapi->password_auth($user,$pass);
    $xmlapi->api2_query($user,'Park','park',array('domain' => 'example.com'));
    ?>
     
    #9 JAB Creations, Oct 22, 2017
    Last edited: Oct 22, 2017
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