我已将PHP配置为在Windows Server 2008上的IIS7上的FastCgi下在Forms Authentication / IIS Integrated Pipeline下运行。 PHP甚至Drupal都为经过身份验证的用户提供了出色的工作。但是,对于匿名请求,所有PHP帖子都会挂起,直到PHP超时,然后返回500.0错误。日志中没有错误,即使打开详细日志记录,返回到屏幕的错误也没有太大帮助:
Internet Information Services 7.5
Error Summary HTTP Error 500.0 - Internal Server Error C:\Program Files (x86)\PHP\php-cgi.exe - The FastCGI process exceeded configured request timeout Detailed Error Information
Module FastCgiModule
Notification ExecuteRequestHandler
Handler PHP_via_FastCGI Error
Code 0x80070102
Requested URL http://localhost/application/test.php
Physical Path D:\Websites\application\test.php
Logon Method Anonymous
Logon User Anonymous
所有经过身份验证的请求都可以正常工作,第二次我将web.config身份验证类型从“Forms”更改为“Windows”或“无”匿名PHP帖子工作。但这并没有解决问题,因为没有人通过验证。 ASP.Net和Classic ASP Posts在PHP匿名帖子失败的相同配置下工作。
我尝试过的一些事情包括......
在本地web.config中添加和删除了FormsAuthentication模块(虽然已经继承):
<modules>
<remove name="FormsAuthentication" />
<add name="FormsAuthentication" type="System.Web.Security.FormsAuthenticationModule" preCondition="" />
</modules>
明确允许访问(虽然已经继承):
<authorization>
<add accessType="Allow" users="*" verbs="GET, POST" />
</authorization>
调整PHP.ini设置,当前设置为:
default_socket_timeout = 60
upload_tmp_dir="C:\Windows\Temp"
session.save_path="C:\Windows\Temp"
log_errors = On
error_log="C:\Windows\temp\php-errors.log"
cgi.force_redirect=0
fastcgi.impersonate=1
cgi.fix_pathinfo=1
fastcgi.logging=0
max_execution_time=30
extension_dir="C:\Program Files (x86)\PHP\ext"
error_reporting = E_ALL & ~E_NOTICE
display_errors = On
max_input_time = 60
memory_limit = 128M
post_max_size = 10M
将应用程序池标识从ApplicationPoolIdentity更改为NetworkService更改为管理员帐户。所有人都表现出同样的行为。
我已经按照MSDN(http://msdn.microsoft.com/en-us/magazine/cc135973.aspx)和IIS.Net(http:// learn。)推荐的PHP.ini和web.config设置进行了操作。 iis.net/page.aspx/246/using-fastcgi-to-host-php-applications-on-iis-7 /).
当我说一个简单的PHP Post失败时,我的意思很简单:
<form action="test.php" method="post">
<input type="text" name="testpost" />
<input type="submit" value="postit" />
</form>
<?php if(isset($_POST['testpost'])) { ?>
Posted: <?php echo($_POST['testpost']) ?>
<?php } else { ?>
Waiting for post...
<?php } ?>
我在网上找到这个问题的唯一参考是在Expert Exchange上的一个未解答的问题(http://www.experts-exchange.com/Software/Server_Software/Web_Servers/Microsoft_IIS/Q_26706716.html)。
我是PHP和IIS7的新手,所以经过几周的修补和开启,我觉得终于有时间去问一下我必须要忽视的简单事情。
有人有什么想法吗?
谢谢!
答案 0 :(得分:1)
您是否尝试将应用程序池设置为“经典”托管管道模式而不是集成?
答案 1 :(得分:0)
我的一位同事发现的问题与我们的web.config有关。具体来说,通过注释掉以下行,POST神奇地开始使用PHP在.NET站点内的虚拟目录中工作(因此我们可以专门使用.NET auth)。
<trace enabled="true" requestLimit="50000000" pageOutput="false" traceMode="SortByTime" localOnly="true"/>