You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

.user.ini中sendmail_path不作用于子目录是否属于PHP Bug?

Is sendmail_path in .user.ini failing to apply to subdirectories a PHP bug?

Short answer: No, this isn’t a PHP bug — it’s intentional behavior rooted in how PHP handles process-level configuration in FastCGI/FPM setups (which is what your WHM environment uses for PHP 5.6).

Here’s why this happens

Let’s break down the key factors:

  • Directive scope rules: In PHP 5.6, sendmail_path is categorized as a PHP_INI_SYSTEM directive. While .user.ini files let you tweak many PHP_INI_PERDIR settings on a per-request, per-directory basis, PHP_INI_SYSTEM directives are meant to be set once when the PHP process starts — they can’t be dynamically adjusted mid-request for subdirectories.
  • PHP-FPM process lifecycle: WHM runs PHP via PHP-FPM, where worker processes are spawned upfront. When a process launches, it reads the initial config (including the .user.ini from your parent directory). Once the process is running, it can’t reinitialize sendmail_path — this setting defines the sendmail binary path for the entire process, not individual requests. Other .user.ini settings (like max_execution_time or display_errors) are request-level, so they can be overridden per directory because they’re applied each time a request is handled.
  • Subdirectory .user.ini limitations: Even if you add sendmail_path to a subdirectory’s .user.ini, PHP will ignore it. The process already locked in that value at startup. Placing a full php.ini in the subdirectory might work (since it can trigger a process restart in some setups), but as you noted, that defeats the point of using .user.ini for centralized, per-user config.

Fixes to get consistent sendmail_path across subdirectories

If you want sendmail_path to apply everywhere under your account, use one of these methods instead:

  • WHM’s PHP Configuration Editor: Use WHM’s built-in tool to set sendmail_path globally for PHP 5.6 (or per-user, if your WHM setup allows it). This ensures the directive is picked up when PHP-FPM processes start, and it will work across all subdirectories.
  • User-level php.ini: Place a php.ini file in your account’s home directory (or the directory where PHP-FPM processes launch for your user). This file is read during process startup, so sendmail_path will take effect for all your account’s requests.

内容的提问来源于stack exchange,提问作者Micah

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.25 07:35:10