我已经按照这里的指示:Using FastCGI to Host PHP Applications on IIS 7来配置Windows 2008,PHP与IIS 7和FastCGI,我遇到了问题。 PHP版本是5.3.8。我已经在IIS上设置了处理程序映射,并创建了一个测试页面,但该页面除了发生500错误外不会返回任何内容。我已经确保了PHP的作品,在命令行中我得到回应,当我进入:PHP IIS 7和FastCGI不工作
php -version.
这么说,我已经打开失败请求跟踪的PHP网页的规则,当我浏览过的错误日志,我看到的东西,如:
<EventData>
<Data Name="ContextId">{00000000-0000-0000-0200-0080010000F6}</Data>
<Data Name="ModuleName">FastCgiModule</Data>
<Data Name="Data1">FASTCGI_RESPONSE_ERROR</Data>
<Data Name="Data2">PHP Warning: phpinfo() [<a href='function.phpinfo'>function.phpinfo</a>]: It is not safe to rely on the system'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 'America/New_York' for '-4.0/DST' instead in C:\inetpub\wwwroot\phpinfo.php on line 1
</Data>
<Data Name="ErrorCode">5</Data>
</EventData>
<RenderingInfo Culture="en-US">
<Opcode>MODULE_WARNING</Opcode>
<Keywords>
<Keyword>Module</Keyword>
</Keywords>
<freb:Description Data="ErrorCode">Access is denied.
(0x5)</freb:Description>
从失败请求日志的顶部,我可以看到它的IUSR帐户下运行:
tokenUserName="NT AUTHORITY\IUSR"
下面是FastCGI的设置:
<fastCgi>
<application fullPath="C:\PHP\php-cgi.exe" instanceMaxRequests="10000">
<environmentVariables>
<environmentVariable name="PHP_FCGI_MAX_REQUESTS" value="10000" />
<environmentVariable name="PHPRC" value="C:\php\php.ini" />
</environmentVariables>
</application>
</fastCgi>
<handlers accessPolicy="Read, Script">
<add name="PHP via FastCGI" path="*.php" verb="*" modules="FastCgiModule" scriptProcessor="C:\PHP\php-cgi.exe" resourceType="Unspecified" requireAccess="Script" />
我确定这个用户名可以完全控制我的C:\ PHP目录。我的php.ini文件在C:\ PHP目录中配置。
除了下面该文章中的方向,我也试图创建一个PHP脚本映射,我创建的时候,我得到了一个差异的错误,而不是500
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.
尽管曾经,IUSR可以完全控制该目录,所以我不太明白为什么会出现这样的错误信息。
更新 这个问题在我的日志中很明显。我已经忽略了关于date.timezone的PHP警告,认为这只是一个警告。我将它设置为:
date.timezone = America/New_York
现在它工作。
哇,这会更容易。我将保存此链接供将来参考。 – mservidio