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.

Unable to retrieve PHP.INI module options

Discussion in 'cPanel Developers' started by goinup, Apr 30, 2012.

  1. goinup

    goinup Registered

    Joined:
    Jan 24, 2012
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Reseller Owner
    Hi

    I am unable to retrieve the PHP.ini settings using the api. The response I get is as follows:

    JSON:
    {
    apiversion = 2;
    data = "<null>";
    event = {
    reason = "Can't coerce array into hash at /usr/local/cpanel/Cpanel/PHPINI.pm line 376.\n";
    result = 0;
    };
    func = getalloptions;
    module = PHPINI;
    }

    I have tried with php path set to all valid values. Using /home/ gives an empty result. All other paths yield a parse error.

    PHP via the CLI gives me:

    php -i | grep 'Configuration File'
    Configuration File (php.ini) Path => /usr/local/lib
    Loaded Configuration File => /usr/local/lib/php.ini

    Using /usr/local/ or /usr/local/lib throws an error.

    Any advice would be greatly appreciated.

    Thanks
    Greg
     
  2. goinup

    goinup Registered

    Joined:
    Jan 24, 2012
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Reseller Owner
    Additional backtrace from cpanel's error log:

    [2012-05-01 03:02:11 +0000] warn [cpanel] Unable to run [Cpanel::PHPINI::api2_getalloptions(2/8)]; Permission denied (Can't coerce array into hash at /usr/local/cpanel/Cpanel/PHPINI.pm line 376.
    ) at /usr/local/cpanel/Cpanel/Api2/Exec.pm line 99
    Cpanel::Api2::Exec::api2_exec('PHPINI', 'getalloptions', HASH(0x8211ab0), HASH(0x82118f0)) called at cpanel line 906
    main::docpanelaction(HASH(0x8211930)) called at cpanel line 4938
    main::run_fast_json_mode() called at cpanel line 415


    Here is one example of the URL being requested:
    https://example.com:2083/json-api/c...sonapi_version=2&cpanel_jsonapi_module=PHPINI

    Thanks
     
    #2 goinup, Apr 30, 2012
    Last edited: Apr 30, 2012
  3. KostonConsulting

    KostonConsulting Well-Known Member

    Joined:
    Jun 17, 2010
    Messages:
    255
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    San Francisco, CA
    cPanel Access Level:
    Root Administrator
    Here's the line (376) in PHPINI.pm that seems to be the issue:

    Code:
    push @{ $SECS{ $rCONF->{'dirs'}{$opt}{'section'} } },
              {
                'directive'  => $opt,
                'value'      => $dirref->{$opt}->{'value'},
                'commented'  => $dirref->{$opt}->{'commented'},
                'info'       => $info,
                'section'    => $rCONF->{'dirs'}{$opt}{'section'},
                'subsection' => $rCONF->{'dirs'}{$opt}{'subsection'}
              };
    
    It seems that either "$rCONF->{'dirs'}{$opt}" or "$dirref->{$opt}" is an ARRAY but cPanel expects it to be a HASH. This seems like a bug in the module as even if your path is wrong, there shouldn't be an incorrect data type, or at least the code should test to prevent this. I'd recommend contacting cPanel support.
     
  4. internex

    internex Registered

    Joined:
    Apr 26, 2012
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Unfortunately, I have the very same problem.
    Did you find a solution for this?

    Otherwise I'd like to *push* the topic...!
    Thank you!
     
Loading...

Share This Page