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!

Disabled functions (disable_functions)

Discussion in 'Security' started by ChrisDeVe, Feb 21, 2019.

  1. ChrisDeVe

    ChrisDeVe Member

    Joined:
    Apr 18, 2018
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    UK
    cPanel Access Level:
    Root Administrator
    Error: API failure: Can't use string ("exec,passthru,shell_exec,system,"...) as a HASH ref while "strict refs" in use at /usr/local/cpanel/Cpanel/PHPFPM.pm line 636.

    I can't see any domains now, I try to remove system_pool_defaults.yaml and rebuild it, no luck.


    This is my new system_pool_defaults.yaml
    ---
    php_admin_flag_allow_url_fopen: 'on'
    php_admin_flag_log_errors: 'on'
    php_admin_value_disable_functions: exec
    php_admin_value_doc_root: "\"[% documentroot %]/\""
    php_admin_value_error_log: "[% homedir %]/logs/[% scrubbed_domain %].php.error.log"
    php_admin_value_short_open_tag: 'on'
    php_value_error_reporting: E_ALL & ~E_NOTICE
    pm_max_children: 5
    pm_max_requests: 20
    pm_process_idle_timeout: 10


    USE:
    Centos : 7.6
    CPanel : v78.0.11
     
  2. cPanelLauren

    cPanelLauren Forums Analyst II Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    5,815
    Likes Received:
    443
    Trophy Points:
    233
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    HI @ChrisDeVe


    How were you making changes to the PHP-FPM configuration? My default system_pool_defaults.yaml looks as follows:

    Code:
    [root@server ~]# cat /var/cpanel/ApachePHPFPM/system_pool_defaults.yaml
    ---
    php_admin_flag_allow_url_fopen: 'on'
    php_admin_flag_log_errors: 'on'
    php_admin_value_disable_functions: exec,passthru,shell_exec,system
    php_admin_value_doc_root: "\"[% documentroot %]/\""
    php_admin_value_error_log: "[% homedir %]/logs/[% scrubbed_domain %].php.error.log"
    php_admin_value_short_open_tag: 'on'
    php_value_error_reporting: E_ALL & ~E_NOTICE
    pm_max_children: 5
    pm_max_requests: 20
    pm_process_idle_timeout: 10
    
    And the following article goes over how to manually modify these directives: Tutorial - Managing php.ini directives with PHP-FPM

    But we also introduced a user interface to manage some of these in v78 of cPanel at WHM>>Software>>MultiPHP -> System PHP-FPM Configuration
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. ChrisDeVe

    ChrisDeVe Member

    Joined:
    Apr 18, 2018
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    UK
    cPanel Access Level:
    Root Administrator
    Hi Lauren

    Thank you for your answer.

    I try your config, same issue, I try to remove all settings and let CPanel to regenerate "system_pool_defaults.yaml" after adding a single ( Disabled functions (disable_functions)) or multiple.

    The error will stay as well if I remove from ( Disabled functions (disable_functions)) all and leave empty

    Thank you
     

    Attached Files:

  4. ChrisDeVe

    ChrisDeVe Member

    Joined:
    Apr 18, 2018
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    UK
    cPanel Access Level:
    Root Administrator
    Hi,

    No solution till now ?

    Thank you
     
  5. cPanelLauren

    cPanelLauren Forums Analyst II Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    5,815
    Likes Received:
    443
    Trophy Points:
    233
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    Hi @ChrisDeVe


    I apologize, this must have been overlooked. It sounds like there's an issue with that disable functions line. Can you show me the system_pool_defaults.yaml?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  6. ChrisDeVe

    ChrisDeVe Member

    Joined:
    Apr 18, 2018
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    UK
    cPanel Access Level:
    Root Administrator
    ---
    php_admin_flag_allow_url_fopen: 'on'
    php_admin_flag_log_errors: 'on'
    php_admin_value_disable_functions: "\"\""
    php_admin_value_doc_root: "\"[% documentroot %]/\""
    php_admin_value_error_log: "[% homedir %]/logs/[% scrubbed_domain %].php.error.log"
    php_admin_value_short_open_tag: 'on'
    php_value_error_reporting: E_ALL & ~E_NOTICE
    pm_max_children: 5
    pm_max_requests: 20
    pm_process_idle_timeout: 10
     
  7. cPanelLauren

    cPanelLauren Forums Analyst II Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    5,815
    Likes Received:
    443
    Trophy Points:
    233
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    Why is this present in the disable functions line?

    Code:
    "\"\""
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  8. ChrisDeVe

    ChrisDeVe Member

    Joined:
    Apr 18, 2018
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    UK
    cPanel Access Level:
    Root Administrator
    In empty will be like that

    So I add for example

    ---
    php_admin_flag_allow_url_fopen: 'on'
    php_admin_flag_log_errors: 'on'
    php_admin_value_disable_functions: exec
    php_admin_value_doc_root: "\"[% documentroot %]/\""
    php_admin_value_error_log: "[% homedir %]/logs/[% scrubbed_domain %].php.error.log"
    php_admin_value_short_open_tag: 'on'
    php_value_error_reporting: E_ALL & ~E_NOTICE
    pm_max_children: 5
    pm_max_requests: 20
    pm_process_idle_timeout: 10

    This will be default now.

    Error: API failure: Can't use string ("exec") as a HASH ref while "strict refs" in use at /usr/local/cpanel/Cpanel/PHPFPM.pm line 636.

    It's seem like faild on this line

    if ( $pool->{$key}{'present_ifdefault'} ) {
    $pool->{$key}{'value'} = $domain_pool_hr->{$key}{'default'} // $system_pool_defaults_hr->{$key}{'default'} // $php_fpm_pool_directives{$key}{'default'};
    }
     
    #8 ChrisDeVe, Mar 27, 2019
    Last edited: Mar 27, 2019
  9. cPanelLauren

    cPanelLauren Forums Analyst II Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    5,815
    Likes Received:
    443
    Trophy Points:
    233
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    Hi @ChrisDeVe


    We've been trying to reproduce the error you're encountering but are unable to. Would it be possible for you to please open a ticket with us using the link in my signature? Once open please update this thread with the ticket ID so that we can add the resolution to this thread.

    Thanks!
     
    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