0

I have confirmed the config

sendmail_path = xxxx

in .user.ini will not apply to subdirectories only the parent directly. ( the other configs will )

If I place another .user.ini in subfolder, it works. php.ini in subfolder will work as well.

That will lose the purpose of using .user.ini. for me in this case. May I ask is this PHP bug ?? and the possible reason of cause?

My environment is Linux with WHM, php version 5.6.

Micah
  • 4,254
  • 8
  • 30
  • 38
  • `.user.ini` files are _per directory_, by definition: ["Since PHP 5.3.0, PHP includes support for configuration INI files on a per-directory basis."](http://php.net/manual/en/configuration.file.per-user.php) Translation: they do not cascade. – bishop Apr 21 '18 at 03:06
  • It should read file in subdirectory but will apply the parent https://stackoverflow.com/questions/27226055/does-the-user-ini-file-work-for-subdirectories – Micah Apr 21 '18 at 03:15
  • No, I think you have that backward: settings do not cascade down, they percolate up. – bishop Apr 21 '18 at 03:24
  • Then will you explain why only "sendmail_path" is not being set? – Micah Apr 21 '18 at 03:27
  • Perhaps I am misunderstanding you. I've made an answer with my understanding of how `.user.ini` files work. Your scenario sounds like the converse of how I'd expect `.user.ini` to work. – bishop Apr 21 '18 at 03:29
  • Stack Overflow is a site for programming and development questions. This question appears to be off-topic because it is not about programming or development. See [What topics can I ask about here](http://stackoverflow.com/help/on-topic) in the Help Center. Perhaps [Web Applications Stack Exchange](http://webapps.stackexchange.com/), [Webmaster Stack Exchange](http://webmasters.stackexchange.com/) or [Unix & Linux Stack Exchange](http://unix.stackexchange.com/) would be a better place to ask. – jww Apr 21 '18 at 10:34

2 Answers2

-1

Given this structure:

.
└── a
    ├── a.php
    ├── b
    │   ├── b.php
    │   └── .user.ini   <== [1]
    └── .user.ini  <== [2]

b.php will see settings from [1] merged with [2], where values in [2] replace those from [1]. a.php will see settings only from [2].

bishop
  • 37,830
  • 11
  • 104
  • 139
  • Hi My case is I dont have [1], so b.php will load [2] but only sendmail_path is not being overwritten. – Micah Apr 21 '18 at 03:42
  • I see now. I was misled by the discussion of `.user.ini`: it's not involved at all. – bishop Apr 21 '18 at 03:48
-1

sendmail_path is defined as being PHP_INI_SYSTEM, meaning it can only be set in the system level settings file, e.g. php.ini.

bishop
  • 37,830
  • 11
  • 104
  • 139