title: php's .user.ini with nginx and subdirectory
body: <h1>Setup</h1>
  
  <p>I have installed nginx 1.2.2 and PHP 5.4.4. I have configured PHP with nginx running as FastCGI.</p>
  
  <p>nginx config snippet:</p>
  
  <pre><code>location ~ \.php$ {
      root           E:/Websites/localhost;
      fastcgi_pass   127.0.0.1:9000;
      fastcgi_index  index.php;
      fastcgi_param  SCRIPT_FILENAME  E:/Websites/localhost/$fastcgi_script_name;
      include        fastcgi_params;
  }
  </code></pre>
  
  <p>I have a number of local virtual sites running on same system. To customize each ones requirements I have created .user.ini file in each sites root folder which as per the PHP documentation should be applicable on sub folders also.</p>
  
  <p>Please note this is a development environment and not live. So I have flexibility to customize a number of things.</p>
  
  <h1>Problem</h1>
  
  <p>When I access any site from the browser it works fine unless I do not dive into some sub folder. It seems that .user.ini does not work in sub directories - at least in my configuration.</p>
  
  <p>As per PHP document (<a href="http://www.php.net/manual/en/configuration.file.per-user.php" rel="nofollow">http://www.php.net/manual/en/configuration.file.per-user.php</a>):</p>
  
  <blockquote>
    <p>In addition to the main php.ini file, PHP scans for INI files in each
    directory, <strong>starting with the directory of the requested PHP file, and
    working its way up to the current document root</strong></p>
  </blockquote>
  
  <h1>SOS</h1>
  
  <p>Has anyone configured .user.ini under nginx - request you to please help me out.</p>
  
  <p>Note: Someone reported a bug in 2009: <a href="https://bugs.php.net/bug.php?id=50374" rel="nofollow">https://bugs.php.net/bug.php?id=50374</a></p>
  
  <h1>More Information (EDIT)</h1>
  
  <p>PHPInfo() says (in root as well as in sub folders):<br>
  * Server API: <em>CGI/FastCGI</em><br>
  * user_ini.filename: <em>.user.ini</em> (local as well as master)</p>
  
  <p>php_sapi_name() says <em>cgi-fcgi</em></p>
  
  <p>These values are present in phpinfo() from root folder and sub directories. So there is no difference in PHPInfo().</p>
  
  <p>Further confirmation that it is running as <strong>CGI/FastCGI</strong> is that root folder is taking configurations from <strong>.user.ini</strong> but not sub folders.</p>
  
  <pre><code>// .user.ini
  auto_prepend_file = "E:\Websites\localhost\user.ini.php"
  </code></pre>
  
  <p>and</p>
  
  <pre><code>// user.ini.php
  &lt;?php
  printf('Hi from: %s', __FILE__);
  ?&gt;
  </code></pre>
  
  <p>This may actually be a bug but has anyone configured PHP with nginx in this way and did not faced the problem. Requesting to please share version numbers and platform in this case.</p>