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.

PHP-FPM and PHP.INI

Discussion in 'EasyApache' started by hrace009, Nov 9, 2016.

Tags:
  1. hrace009

    hrace009 Well-Known Member

    Joined:
    Dec 24, 2013
    Messages:
    71
    Likes Received:
    10
    Trophy Points:
    8
    Location:
    Root
    cPanel Access Level:
    Root Administrator
    Twitter:
    I have upgrade to V60 and using php-fpm from interfaces WHM, and everything running correctly.
    But seems php-fpm cannot load php.ini at domain root directory.
    PHP-FPM always load default php.ini
    Anyone can help to solve this problem?

    Thank You
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    37,037
    Likes Received:
    1,278
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
  3. hrace009

    hrace009 Well-Known Member

    Joined:
    Dec 24, 2013
    Messages:
    71
    Likes Received:
    10
    Trophy Points:
    8
    Location:
    Root
    cPanel Access Level:
    Root Administrator
    Twitter:
    hi thanks for the reply, but seems doesn't solved my problem, since i don't see anything relate with php.ini

    when i turn off PHP-FPM, i can use costume php.ini from domain root directory.
    but if i enable PHP-FPM, it can't use costume php.ini from domain root directory.
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    37,037
    Likes Received:
    1,278
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Edited with updated instructions:

    Hello,

    To update, the instructions for making changes to specific domain's pool are documented at:

    PHP-FPM and EasyApache 4 - Documentation - cPanel Documentation

    In particular, this is the file path to edit:

    Code:
    /var/cpanel/userdata/[user]/[domain].php-fpm.yaml
    This document provides information about how to formulate the custom entries:

    Configurations Values of PHP-FPM - Documentation - cPanel Documentation

    Then, after making those changes to the YAML file, run the following command:

    Code:
    /scripts/php_fpm_config --rebuild --domain=domain
    This script is documented at:

    The php_fpm_config Script - Documentation - cPanel Documentation

    Thank you.
     
    #4 cPanelMichael, Nov 17, 2016
    Last edited: Dec 7, 2016
  5. teo_

    teo_ Member

    Joined:
    Nov 21, 2008
    Messages:
    13
    Likes Received:
    1
    Trophy Points:
    53
    I tried to change some values from this file /opt/cpanel/ea-php56/root/etc/php-fpm.d/my.domain.conf like
    Code:
    ; php_admin_value[error_log] = /home/myhome/logs/my_domain.php.error.log
    php_admin_value[error_log] = /home/myhome/logs/my_domain.php.errortest.log
    then I used the command
    /etc/init.d/ea-php56-php-fpm restart

    but nothing has changed: I still see the old error log growing.
     
  6. teo_

    teo_ Member

    Joined:
    Nov 21, 2008
    Messages:
    13
    Likes Received:
    1
    Trophy Points:
    53
    Hem, sorry, it worked: I was watching the wrong folder :oops:
     
    cPanelMichael likes this.
  7. jonh

    jonh Well-Known Member

    Joined:
    Feb 15, 2016
    Messages:
    55
    Likes Received:
    3
    Trophy Points:
    8
    Location:
    NY
    cPanel Access Level:
    Root Administrator
    Can you just copy the php.ini contents into the my.domain.conf or do they have to be formatted differently?

    All of our sites use a security plugin which relies on php.ini or user.ini in the domains public html folder and they all do not work now because of this.
     
  8. digitaliway

    digitaliway Member

    Joined:
    Feb 17, 2015
    Messages:
    14
    Likes Received:
    1
    Trophy Points:
    3
    cPanel Access Level:
    Root Administrator
    Can someone just provide a simple step by step way to make an adjustment PER DOMAIN WHILE USING PHP FPM for max_execution_time, input vars, memory??

    I tried to change the file /opt/cpanel/ea-php56/root/etc/php-fpm.d/my.domain.conf - by SSH and I get this message:
    ; NOTICE This file is generated, please use our WHM User Interface
    ; to set these values.
     
  9. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    37,037
    Likes Received:
    1,278
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    To update, the instructions for making changes to specific domain's pool are documented at:

    PHP-FPM and EasyApache 4 - Documentation - cPanel Documentation

    In particular, this is the file path to edit:

    Code:
    /var/cpanel/userdata/[user]/[domain].php-fpm.yaml
    This document provides information about how to formulate the custom entries:

    Configurations Values of PHP-FPM - Documentation - cPanel Documentation

    Then, after making those changes to the YAML file, run the following command:

    Code:
    /scripts/php_fpm_config --rebuild --domain=domain
    This script is documented at:

    The php_fpm_config Script - Documentation - cPanel Documentation

    Thank you.
     
  10. Jonathan Moore

    Joined:
    Feb 26, 2017
    Messages:
    12
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    London
    cPanel Access Level:
    Root Administrator
    I have the same issue as @jonh the "security plugin which relies on php.ini or user.ini in the domains public html folder and they all do not work now because of this"

    The plugin adds a directive:
    auto_prepend_file = [filepath]

    the conversation has then tracked into modifying the pool settings via the yaml which doesn't address this case.

    There is a reference above to an earlier message I don't have permission to see with a quote:
    "It's not possible at this time. You have to actually edit the "/opt/cpanel/ea-php$$/root/etc/php-fpm.d/domain.com.conf" file instead of the php.ini file."

    So do I actually have to go through copying all info from user.ini from all sites into these .conf files?
    jonh was also asking: "Can you just copy the php.ini contents into the my.domain.conf or do they have to be formatted differently?"

    also, the domain files in /opt/cpanel/ea-php70/root/etc/php-fpm.d
    have a notice:
    "
    ; NOTICE This file is generated, please use our WHM User Interface
    ; to set these value.
    "
    so in that case the files should not be edited manually?

    was this answered?

    thanks,
     
  11. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    37,037
    Likes Received:
    1,278
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello @Jonathan Moore,

    The intention is that changes made via cPanel's MultiPHP INI Editor are enacted no matter the PHP handler. I believe the issue you are noticing is related to an internal case that's open related to PHP-FPM and php.ini modifications. A link to the thread where this is discussed is located at:

    MultiPHP INI Editor file name .user.ini instead of php.ini

    Thank you.
     
  12. Jonathan Moore

    Joined:
    Feb 26, 2017
    Messages:
    12
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    London
    cPanel Access Level:
    Root Administrator
    Hi, thanks for reply, I'm not sure if it's the same or not.
    I am not referring to changes made by MultiPHP INI Editor.
    The question is about.ini entries in the domain root directory being ignored when PHP-FPM is enabled.

    In this case a widely used security tool that adds itself to all php requests for each site by adding a user.ini entry for auto_prepend_file = [filepath]
    (actually more than one tool that does this from my observations on the WordPress support forums)

    Since turning on PHP-FPM this is not working and it's not quite clear from this thread whether the entries should be added manually or via WHM into my.domain.conf in /opt/cpanel/ea-php70/root/etc/php-fpm.d or into other .ini file
     
  13. Jonathan Moore

    Joined:
    Feb 26, 2017
    Messages:
    12
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    London
    cPanel Access Level:
    Root Administrator
    I noticed a couple of additional points during testing:
    • phpinfo() from the root url shows the local setting applied [even though the local config file does not appear in "Additional .ini files parsed"], however a phpinfo() called from any subdirectory does not show the setting, whereas normally it would.
    • there is an entry: /opt/cpanel/ea-php71/root/etc/php.ini:661:auto_prepend_file = and it is suggested that in some circumstances this entry suppresses user settings, though I was unable to verify by commenting this line out
     
  14. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    37,037
    Likes Received:
    1,278
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello @Jonathan Moore,

    Could you open a support ticket using the link in my signature so we can take a closer look at the affected system and verify if the issue is related to internal case CPANEL-11563? You can post the ticket number here so we can update this thread with the outcome.

    Thank you.
     
  15. Jonathan Moore

    Joined:
    Feb 26, 2017
    Messages:
    12
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    London
    cPanel Access Level:
    Root Administrator
  16. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    37,037
    Likes Received:
    1,278
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    CPANEL-11563 relates to changes made through the cPanel MultiPHP INI Editor not reflecting within PHP-FPM. EA-5425 relates to custom PHP-FPM values overriding the global PHP configuration values configured in WHM's MultiPHP INI Editor feature.

    In either case, I recommend opening a support ticket so we can take a closer look and verify what's happening on the system.

    Thank you.
     
  17. Jonathan Moore

    Joined:
    Feb 26, 2017
    Messages:
    12
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    London
    cPanel Access Level:
    Root Administrator
    I was able to verify this type of workaround commented on other threads and forums:
    1.Edit the file /var/cpanel/userdata/[user]/[domain].php-fpm.yaml
    2.Add the line:
    php_admin_value_auto_prepend_file: { name: 'php_admin_value[auto_prepend_file], value: '/home/[user]/public_html/wordfence-waf.php' }
    3.Rebuild the PHP-FPM config for that domain by running:
    /scripts/php_fpm_config –-rebuild –-domain=[domain]

    In all cases replace [user] with the user account and [domain] with the domain name.

    Enabling PHP-FPM in MultiPHP Manager
     
    Del Drago likes this.

Share This Page