[英]PHP IIS 7 and FastCGI not working
我已經按照這里的指示進行操作: 使用FastCGI在IIS 7上托管PHP應用程序以配置Windows 2008,帶有IIS 7和FastCGI的PHP,並且遇到了問題。 PHP版本是5.3.8。 我已經在IIS上設置了Handler映射,並創建了一個測試頁面,盡管該頁面除了500錯誤外不返回任何內容。 我確保PHP可以正常工作,在輸入時從命令行獲得響應:
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
現在可以了。
為了將來參考,您可以使用http://php.iis.net/輕松將php安裝到IIS安裝程序中。 它帶有一個管理器,該管理器還可以讓您進入“開發模式”,該模式將顯示php錯誤,而不是將其覆蓋。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.