[英]PHP IIS 7 and FastCGI not working
I've followed the directions here: Using FastCGI to Host PHP Applications on IIS 7 to configure Windows 2008, PHP with IIS 7 and FastCGI, and I'm running into issues. 我已经按照这里的指示进行操作: 使用FastCGI在IIS 7上托管PHP应用程序以配置Windows 2008,带有IIS 7和FastCGI的PHP,并且遇到了问题。 The PHP version is 5.3.8.
PHP版本是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.
我已经在IIS上设置了Handler映射,并创建了一个测试页面,尽管该页面除了500错误外不返回任何内容。 I've ensured that PHP works, from the command line I get a response when I enter:
我确保PHP可以正常工作,在输入时从命令行获得响应:
php -version.
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: 就是说,我已经为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>
From the top of the failed request log, I can see it's running under IUSR account: 从失败的请求日志的顶部,我可以看到它正在IUSR帐户下运行:
tokenUserName="NT AUTHORITY\IUSR"
Here's settings for the fastCgi: 这是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" />
I've ensure that this user name has full control over my C:\\PHP directory. 我确保此用户名对我的C:\\ PHP目录具有完全控制权。 My php.ini file is configured within C:\\PHP directory.
我的php.ini文件在C:\\ PHP目录中进行配置。
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. 除了按照该文章中的说明进行操作外,我还尝试为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.
Once again though, IUSR has full control over that directory so I don't quite understand why that error message. 但是,IUSR再次完全控制了该目录,因此我不太明白为什么会出现该错误消息。
Update 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.
关于date.timezone,我已经忽略了PHP警告,认为这只是警告。 I set it to:
我将其设置为:
date.timezone = America/New_York
and now it works. 现在可以了。
For future reference you can use http://php.iis.net/ to easily install php into your IIS setup. 为了将来参考,您可以使用http://php.iis.net/轻松将php安装到IIS安装程序中。 It comes with a manager which will also let you go into 'development mode' which will display php errors as opposed to covering them up.
它带有一个管理器,该管理器还可以让您进入“开发模式”,该模式将显示php错误,而不是将其覆盖。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.