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!

php.ini (user.ini) in php-fpm and subdirectories

Discussion in 'EasyApache' started by opt2bout, Jun 10, 2017.

Tags:
  1. opt2bout

    opt2bout Well-Known Member

    Joined:
    Nov 10, 2006
    Messages:
    64
    Likes Received:
    1
    Trophy Points:
    158
    I have found a couple of threads on internal case issues and reports regarding php.ini (or .user.ini and .htaccess) to override default PHP settings per domain.

    I have even opened up a case, and closed it thinking the issue was resolved.

    With an fpm enabled account, the php.ini overrides only apply to that directory. Subdirectories below are requiring that we copy the .user.ini to each directory where we have an application below the root public_html.

    Is this the way its supposed to work? If so, are there any alternatives to fpm for performance that work where we can just set a single php configuration file at the root and have it apply to all sub-directories?
     
  2. Anoop P Alias

    Anoop P Alias Well-Known Member

    Joined:
    Mar 31, 2015
    Messages:
    91
    Likes Received:
    14
    Trophy Points:
    8
    Location:
    Kochi,Kerala,India
    cPanel Access Level:
    Root Administrator
    The .user.ini is a per directory ini file and affects on the directory the file resides.

    If you need to change php.ini settings on a global scale edit multiPHP ini editor in WHM or if you wish to do this on a per domain basis, you can edit the php-fpm pool file that cPanel creates for the domain which will then affect all directories.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. opt2bout

    opt2bout Well-Known Member

    Joined:
    Nov 10, 2006
    Messages:
    64
    Likes Received:
    1
    Trophy Points:
    158
    So the only way to change php.ini setting using php-fpm is to have the system administrator modify the /opt/cpanel/ea-php70/root/etc/php-fpm.d/[[domain]].conf file and restart fpm? So shouldn't the settings in the user's cPanel be disabled?
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    43,940
    Likes Received:
    1,819
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    It looks to relate to the internal case referenced on the following thread:

    .user.ini files not recursive

    Let us know if the workaround referenced on that thread helps.

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. opt2bout

    opt2bout Well-Known Member

    Joined:
    Nov 10, 2006
    Messages:
    64
    Likes Received:
    1
    Trophy Points:
    158
    Was building a new server and got delayed in testing this. Yes, this change fixed the issue. We can now have one .user.ini in the public_html directory and all sub-directories are applied. Ideally this would work if we chose to place the .user.ini file in the home directory as well.
     
  6. bgarrant

    bgarrant Well-Known Member

    Joined:
    Jun 27, 2012
    Messages:
    66
    Likes Received:
    9
    Trophy Points:
    8
    cPanel Access Level:
    Root Administrator
    Did you try a .user.ini in the home directory (/home/user)? It does seem to work recursively. Just wondering if it is OK to do it this way as all the docs I see say to have the .user.ini in the public_html folder. Also, how can I make it so my clients can't modify the .user.ini file? I am trying to use this to just add an open_basedir restriction.
     
  7. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    43,940
    Likes Received:
    1,819
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    We recommend using the INI Editor in cPanel to make these types of changes as this ensures the proper entries/files are automatically populated in the event the handler changes in the future. There's not currently a supported method to prevent user modifications to individual PHP configuration files with suPHP, aside from the workarounds referenced in this post:

    How to configure SuPHP to use only the MultiPHP INI file, not user inis, and open_basedir?

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...
Similar Threads - (user ini) subdirectories
  1. Remitur
    Replies:
    5
    Views:
    208

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