I have configured PHP to run under FastCgi on IIS7 on Windows Server 2008 under Forms Authentication/IIS Integrated Pipeline. PHP and even Drupal is working brilliantly for authenticated users. For anonymous requests however, all PHP Posts hang until the PHP Timeout and then return a 500.0 Error. No error appears in the log, and the error returned to screen isn't too helpful even with verbose logging turned on:
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
All authenticated requests work fine, and the second I change the web.config authentication type from "Forms" to "Windows" or "None" Anonymous PHP Posts work. But this doesn't solve the problem because then no one is authenticated. ASP.Net and Classic ASP Posts work under the same configuration that PHP anonymous Posts are failing.
Just a few of the things I've tried include...
Added and removed the FormsAuthentication Module in the local web.config (though already inherited):
<modules>
<remove name="FormsAuthentication" />
<add name="FormsAuthentication" type="System.Web.Security.FormsAuthenticationModule" preCondition="" />
</modules>
Explicitly Allowed Access (though already inherited):
<authorization>
<add accessType="Allow" users="*" verbs="GET, POST" />
</authorization>
Tweaked the PHP.ini settings, currently set to:
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
Changed the Application Pool Identity from ApplicationPoolIdentity to NetworkService to Administrator accounts. All gave the same behavior.
I have followed the PHP.ini and web.config settings recommended on MSDN (http://msdn.microsoft.com/en-us/magazine/cc135973.aspx) and IIS.Net (http://learn.iis.net/page.aspx/246/using-fastcgi-to-host-php-applications-on-iis-7/).
When I say a simple PHP Post fails, I mean simple:
<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 } ?>
The only reference I have found to this problem online is an unanswered question on Experts Exchange (http://www.experts-exchange.com/Software/Server_Software/Web_Servers/Microsoft_IIS/Q_26706716.html).
I am new to PHP and IIS7, so after several weeks tinkering with this on and off, I figured it was finally time to ask to see what simple thing is I must be overlooking.
Anyone have any ideas?
Thanks!