Windows server: PHP form posts, but returns 500 - headers show only asp.net
So, we've got PHP 5.3.2 installed on a Windows 2008 R2 Server. PHP.ini file is loaded, everything looks good on that end. We are also running IIS 7.5 and ISAPI_Rewrite. We have a PHP-based CMS installed and it runs dandy.
The problem lies with posting variables. Example:
We have a contact page: http://example.com/contact with a form that posts the variables on submit via PHP.
But then, when a user submits the form, it seems as if any page with variables POSTed (like this one) end up returning a 500 error.
EDIT I have another idea: Not sure whether it could have to do with the .htaccess files. This server gives 500 errors for, like, everything.
T开发者_JAVA百科he CMS we're using passes everything through an index.php file, so our .htaccess file takes index.php out of the url so that urls are clean.
RewriteEngine on
RewriteCond $1 !^(images|documents|admin|themes|favicon\.ico|robots\.txt|index\.php) [NC]
RewriteRule ^(.*)$ /index.php/$1 [L]
The headers for the posted-to page are as follows:
Request URL:http://domain.com/
Request Method:POST
Status Code:500 Internal Server Error
**Request Headers**
Accept:application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png;q=0.5
Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3
Accept-Encoding:gzip,deflate,sdch
Content-Type:application/x-www-form-urlencoded
I could be way off here, but is there some sort of regex or setting I missed in IIS that any .php file with post variables is just not assigned to get picked up by PHP?
*EDITS / UPDATES * I RDC'd into the computer to test, and also turned on Detailed error reporting. The website, with clean URLs, works fine until submitting a form.
Server error: HTTP Error 500.0 - Internal Server Error
The FastCGI process exceeded configured activity timeout (it took a while)
Handler: PHP5
And then in the logs:
2011-01-12 16:57:56 10.64.181.170 POST /index.php/ - 80 - 10.64.181.170 Mozilla/4.0+(compatible;+MSIE+7.0;+Windows+NT+6.1; +WOW64;+Trident/4.0;+SLCC2;+.NET+CLR+2.0.50727; +.NET4.0C;+.NET4.0E) 500 0 258 82850
--Steph
I encountered this today on a customer website.
This customer was using UMBRACO as their CMS and had a large web.config file in the root of the site.
My background is in Linux rather than Windows, however after randomly shotgun-removing lines from the web.config, I discovered the problematic line was something like:
<trace enabled="true" requestLimit="10" pageOutput="false" traceMode="SortByTime" localOnly="true" />
If you are still having this problem, check to see if you have a web.config in the root of the site with a line similar to this in it. Commenting it out seemed to do the trick, I'm not sure what it is used for.
IIS does not natively support .htaccess files and rewrite rules. To work around that you need to:
- Install URL Rewrite for IIS
- In IIS manager for your site double-click URL Rewrite
- Click Import Rules
- Locate your .htaccess file on the disk
- Click Import
- Review and click Apply
IIS rewrite rules will get saved as web.config XML file. Conversion works out-of-the-box for most rewrite rules.
精彩评论