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!

Errors running cPanel API 1 for cPAddons

Discussion in 'cPanel Developers' started by JetfireMike, Sep 17, 2016.

  1. JetfireMike

    JetfireMike Registered

    Sep 17, 2016
    Likes Received:
    Trophy Points:
    cPanel Access Level:
    Root Administrator
    I am attempting to use the cPanel API 1 to access cPAddons as per cPanel API 1 Functions - cPAddons::mainpg - Software Development Kit - cPanel Documentation.

    When running the example given against the user site1x..

    cpapi1 --user=site1x cPAddons mainpg
    ..I receive this response:

    [2016-09-17 12:04:59 -0700] warn [Internal Warning while parsing unknown 25878] Can't use string ("") as a HASH ref while "strict refs" in use at /usr/local/cpanel/Cpanel/ line 330.
            ...caught at line 1790.
     at line 1790.
            cpanel::cpanel::_api1("cPAddons", "cpaddons", "mainpg()", "mainpg", ARRAY(0x75bbff0), "none", undef, undef) called at line 1720
            cpanel::cpanel::real_exectag("<cpanel cPAddons=\"mainpg()\">", undef, undef, 1) called at line 1428
            cpanel::cpanel::docpanelaction(HASH(0x622dd08)) called at line 4969
            cpanel::cpanel::run_fast_json_mode() called at line 832
            cpanel::cpanel::script("cpanel::cpanel", "--json-fast-connect", "--stdin") called at line 295
    [2016-09-17 12:04:59 -0700] warn [cPAddons::mainpg] Encountered error in cPAddons::mainpg: cPAddons::mainpg() failed: Can't use string ("") as a HASH ref while "strict refs" in use at /usr/local/cpanel/Cpanel/ line 330.
    apiversion: 1
      result: "<div class=\"body-content\">\n<style>#er { color: #FF0000; }</style>\n"
    error: "cPAddons::mainpg() failed: Can't use string (\"\") as a HASH ref while \"strict refs\" in use at /usr/local/cpanel/Cpanel/ line 330.\n"
      reason: "cPAddons::mainpg() failed: Can't use string (\"\") as a HASH ref while \"strict refs\" in use at /usr/local/cpanel/Cpanel/ line 330.\n"
      result: 0
    func: mainpg
    module: cPAddons
    source: module
    type: event
    It appears to be expecting parameters; however, no matter what I supply to it, I end up with the same HASH ref error.

    In looking at the module file in question (/usr/local/cpanel/Cpanel/ it appears that any params passed to it are passed as a string and not as a hash; therefore, it errors out. I cannot figure out how to pass it the parameters in the format expected.

    Any assistance would be appreciated! I eventually want to install the cPanel::Blogs::WordPress addon via the API, but I can't seem to get past step one yet.
  2. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Apr 11, 2011
    Likes Received:
    Trophy Points:
    cPanel Access Level:
    Root Administrator

    There's currently an internal case open reporting this issue. For reference, the case number is PH-3902. I'll update this thread with more information on the status of this case as it becomes available. You should still be able to utilize this API function via methods other than cpapi1 on the command line.

    Thank you.
    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