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!

SOLVED How-To Modify PHP-FPM Configuration Directives in EasyApache 4

Discussion in 'EasyApache' started by celiac101, Apr 5, 2019.

Tags:
  1. celiac101

    celiac101 Well-Known Member

    Joined:
    Dec 19, 2012
    Messages:
    85
    Likes Received:
    1
    Trophy Points:
    8
    cPanel Access Level:
    Website Owner
    [Moderation Notice: This thread was forked from PHP-FPM Restart Necessary for Site Speed]

    I am having an issue with my solution to #1. It seemed to work, but then I noticed I got a formatting error:
    php-fpm.yaml” file and did not apply any custom values.For more information about the correct formatting of custom values, read our Custom Templates

    I use PHP 7.2 and PHP-FPM Ondemand, have formatted it several different ways in my php-fpm.yaml file, but even if it restarts without the error, I get a 503 site error:
    1)
    emergency_restart_threshold = 5
    emergency_restart_interval = 1m
    process_control_timeout = 10s

    2)
    pm_emergency_restart_threshold = 5
    pm_emergency_restart_interval = 1m
    pm_process_control_timeout = 10s

    3)
    pm.emergency_restart_threshold = 5
    pm.emergency_restart_interval = 1m
    pm.process_control_timeout = 10s

    4)
    pm_emergency_restart_threshold: 5
    pm_emergency_restart_interval: 1m
    pm_process_control_timeout: 10s

    Any idea on how to format this for PHP 7.2?
     
    #1 celiac101, Apr 5, 2019
    Last edited by a moderator: Apr 18, 2019
  2. celiac101

    celiac101 Well-Known Member

    Joined:
    Dec 19, 2012
    Messages:
    85
    Likes Received:
    1
    Trophy Points:
    8
    cPanel Access Level:
    Website Owner
    I seem to be stuck with how to edit the those settings. If I manually put them into the file (/opt/cpanel/ea-php72/root/etc/php-fpm.conf), it gets erased when I rebuild them (/scripts/php_fpm_config --rebuild –domain=domain.com), and they are lost:

    emergency_restart_interval = 60
    emergency_restart_threshold = 5
    process_control_timeout = 10

    But the settings do seem to be working there. I have tried many ways to add these to my .yaml file so that this will not happen, but each way I have tried results in an unresponsive server--503 errors.
    /var/cpanel/userdata/site/domain.com.php-fpm.yaml

    In the config file it says to edit the settings in the WHM interface, but when I am there I see no way to do this:

    upload_2019-4-7_12-17-58.png

    Any help with this would be appreciated.
     
  3. cPanelMichael

    cPanelMichael Technical Support Community Manager Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    47,009
    Likes Received:
    2,123
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello @celiac101,

    Thanks for sharing the additional information.

    The PHP-FPM Global directives are configured separately from the PHP-FPM Pool directives.

    To modify the value for a PHP-FPM configuration directive, it's important to first browse to the Configuration Values of PHP-FPM document and search for the name of the directive you want to modify. Directives listed under the Global directives section of this document are known as Global directives. Directives listed under the Pool name directives section of this document are known as Pool directives.

    Pool Directives
    Defaults: /var/cpanel/ApachePHPFPM/system_pool_defaults.yaml
    Individual Domains: /var/cpanel/userdata/$username/$domain.tld.php-fpm.yaml

    Global Directives
    Defaults: /var/cpanel/ApachePHPFPM/system.yaml
    Individual Domains: N/A

    For example, the following PHP-FPM configuration directives are listed under the Global directives section of the Configuration Values of PHP-FPM document:

    emergency_restart_threshold
    emergency_restart_interval

    To modify the values for both of these Global directives, create the /var/cpanel/ApachePHPFPM/system.yaml file and populate it with the following lines:

    Code:
    ---
    emergency_restart_threshold: 10
    emergency_restart_interval: 1m
    Feel free to replace "10" and "1m" with your own values. After saving the file, run the following command to apply the changes to the PHP-FPM configuration files:

    Code:
    /scripts/php_fpm_config --rebuild
    Note: If you see an error message in this command's output, verify no Global directives exist in the following Pool directive configuration files:

    /var/cpanel/ApachePHPFPM/system_pool_defaults.yaml
    /var/cpanel/userdata/$username/$domain.tld.php-fpm.yaml


    Let me know if this helps.

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. cPanelMichael

    cPanelMichael Technical Support Community Manager Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    47,009
    Likes Received:
    2,123
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello @celiac101,

    I modified my previous post to correct the invalid configuration paths and to share more information about configuring PHP-FPM directives. Additionally, I moved the posts specific to this issue into a separate forums thread.

    Let me know if you have any additional questions or if you encounter any issues with the updated instructions.

    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