title: PHP IIS 7 and FastCGI not working
body: <p>I've followed the directions here: <a href="http://learn.iis.net/page.aspx/246/using-fastcgi-to-host-php-applications-on-iis-7/" rel="nofollow">Using FastCGI to Host PHP Applications on IIS 7</a> to configure Windows 2008, PHP with IIS 7 and FastCGI, and I'm running into issues. The PHP version is 5.3.8. I've setup the Handler Mappings on IIS, and created a test page, though the page doesn't return anything except for a 500 error. I've ensured that PHP works, from the command line I get a response when I enter:</p>
  
  <pre><code>php -version.
  </code></pre>
  
  <p>That said, I've turned on Failed Request Tracing Rules for php pages, and when I browse through the error log, I see things like:</p>
  
  <pre><code>&lt;EventData&gt;
    &lt;Data Name="ContextId"&gt;{00000000-0000-0000-0200-0080010000F6}&lt;/Data&gt;
    &lt;Data Name="ModuleName"&gt;FastCgiModule&lt;/Data&gt;
    &lt;Data Name="Data1"&gt;FASTCGI_RESPONSE_ERROR&lt;/Data&gt;
    &lt;Data Name="Data2"&gt;PHP Warning:  phpinfo() [&amp;lt;a href=&amp;apos;function.phpinfo&amp;apos;&amp;gt;function.phpinfo&amp;lt;/a&amp;gt;]: It is not safe to rely on the system&amp;apos;s timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected &amp;apos;America/New_York&amp;apos; for &amp;apos;-4.0/DST&amp;apos; instead in C:\inetpub\wwwroot\phpinfo.php on line 1
  &lt;/Data&gt;
  &lt;Data Name="ErrorCode"&gt;5&lt;/Data&gt;
   &lt;/EventData&gt;
   &lt;RenderingInfo Culture="en-US"&gt;
    &lt;Opcode&gt;MODULE_WARNING&lt;/Opcode&gt;
    &lt;Keywords&gt;
    &lt;Keyword&gt;Module&lt;/Keyword&gt;
    &lt;/Keywords&gt;
    &lt;freb:Description Data="ErrorCode"&gt;Access is denied.
   (0x5)&lt;/freb:Description&gt;
  </code></pre>
  
  <p>From the top of the failed request log, I can see it's running under IUSR account:</p>
  
  <pre><code>tokenUserName="NT AUTHORITY\IUSR"
  </code></pre>
  
  <p>Here's settings for the fastCgi:</p>
  
  <pre><code>&lt;fastCgi&gt;
      &lt;application fullPath="C:\PHP\php-cgi.exe" instanceMaxRequests="10000"&gt;
          &lt;environmentVariables&gt;
              &lt;environmentVariable name="PHP_FCGI_MAX_REQUESTS" value="10000" /&gt;
              &lt;environmentVariable name="PHPRC" value="C:\php\php.ini" /&gt;
          &lt;/environmentVariables&gt;
      &lt;/application&gt;
  &lt;/fastCgi&gt;
  
  &lt;handlers accessPolicy="Read, Script"&gt;
      &lt;add name="PHP via FastCGI" path="*.php" verb="*" modules="FastCgiModule" scriptProcessor="C:\PHP\php-cgi.exe" resourceType="Unspecified" requireAccess="Script" /&gt;
  </code></pre>
  
  <p>I've ensure that this user name has full control over my C:\PHP directory. My php.ini file is configured within C:\PHP directory.</p>
  
  <p>In addition to following the directions in that article, I also tried to create a script map for PHP, and when I created that I got a difference error, not a 500.</p>
  
  <pre><code>HTTP Error 403.1 - Forbidden
  You have attempted to run a CGI, ISAPI, or other executable program from a directory that does not allow executables to run.
  </code></pre>
  
  <p>Once again though, IUSR has full control over that directory so I don't quite understand why that error message.</p>
  
  <p><strong>Update</strong>
  The issue was glaring right at me in the log. I had ignored the PHP Warning with regard to the date.timezone thinking that it's just a warning. I set it to:</p>
  
  <pre><code>date.timezone = America/New_York
  </code></pre>
  
  <p>and now it works.</p>