title: How to set the php.ini path for PHP CGI/FastCGI SAPI on Windows Server 2008 r2?
body: <p>I have IIS 7.0 and two versions PHP <code>v5</code> and <code>v7</code> on my Microsoft Windows Server 2008 Standard 6.0 SP2. The problem is, that PHP7 or IIS tries to use the php.ini of PHP5 for IIS "websites".</p>
  
  <p>So on the command line everything is fine:</p>
  
  <pre><code>X:\&gt;php -v
  PHP 7.0.2 (cli) (built: Jan  6 2016 12:59:59) ( NTS )
  Copyright (c) 1997-2015 The PHP Group
  Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies
  
  X:\&gt;php --ini
  Configuration File (php.ini) Path: C:\Windows
  Loaded Configuration File:         D:\Data\Programme\php7\php.ini
  Scan for additional .ini files in: (none)
  Additional .ini files parsed:      (none)
  </code></pre>
  
  <p>But in the IIS Manager and in the <code>phpinfo()</code> output not:</p>
  
  <p><img src="https://i.stack.imgur.com/qCHNh.png" alt="IIS-website-PHP-setting"></p>
  
  <p><img src="https://i.stack.imgur.com/CJpsu.png" alt="phpinfo-version-sapi-php-ini"></p>
  
  <p>I think, it's a PHP (<code>cgi-fcgi</code> SAPI) issue, <em>not</em> an IIS issue (but not sure).</p>
  
  <p><strong>How to set the correct <code>php.ini</code> for PHP CGI/FastCGI SAPI on Windows Server 2008?</strong></p>
  
  <hr>
  
  <p>Also tried it over the Registry, but that didn't help:</p>
  
  <p><img src="https://i.stack.imgur.com/n2SCk.png" alt="registry-php-IniFilePath"></p>