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.

Errors running cPanel API 1 for cPAddons

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

Tags:
  1. JetfireMike

    JetfireMike Registered

    Joined:
    Sep 17, 2016
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Washington
    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..

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

    Code:
    [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/cPAddons.pm line 330.
            ...caught at cpanel.pl line 1790.
     at cpanel.pl line 1790.
            cpanel::cpanel::_api1("cPAddons", "cpaddons", "mainpg()", "mainpg", ARRAY(0x75bbff0), "none", undef, undef) called at cpanel.pl line 1720
            cpanel::cpanel::real_exectag("<cpanel cPAddons=\"mainpg()\">", undef, undef, 1) called at cpanel.pl line 1428
            cpanel::cpanel::docpanelaction(HASH(0x622dd08)) called at cpanel.pl line 4969
            cpanel::cpanel::run_fast_json_mode() called at cpanel.pl line 832
            cpanel::cpanel::script("cpanel::cpanel", "--json-fast-connect", "--stdin") called at cpanel.pl 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/cPAddons.pm line 330.
    
    --- 
    apiversion: 1
    data: 
      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/cPAddons.pm line 330.\n"
    event: 
      reason: "cPAddons::mainpg() failed: Can't use string (\"\") as a HASH ref while \"strict refs\" in use at /usr/local/cpanel/Cpanel/cPAddons.pm 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/cPAddons.pm) 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 Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello,

    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.
     
Loading...

Share This Page