1
votes

I am uploading small images to a local IIS server running PHP. The images are sent by a POST HTTP request. Whenever the post size exceeds 16kB I get a 500 response from the server saying:C:\PhP\php-cgi.exe - The FastCGI process exited unexpectedly.

The problem persists even if I reduce the PHP script to:

<?php 
?>

Also the problem did not occur when I ran the script on mongoose. php_errors.log does not mention the problematic script. I checked my php.ini file for post_max_size and memory_limit and what have you and found nothing to justify a PhP crash on 16kB of data.

I'm pretty new to IIS but I suspect the problem is there. I checked system.webServer/security/requestFiltering and found these values:

  • maxAllowedContentLength: 30000000
  • maxQueryString: 2048
  • maxURL: 4096

I have no idea what could be causing the problem or where to look next. Any help would be appreciated.

EDIT: I found out that http.sys limits request content to 16 kB by default and changed that by adding a MaxRequestBytes field with 16MB value to registry HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HTTP\Parameters. I was sure that was going to solve it, but it didn't.

1
Suffering from the same issue. Did you manage to resolve this in any way? - BinarySolo
Unfortunately not. I eventually gave up on IIS and changed the whole backend. - Ammar Al-Omary
Thanks for the update, much appreciated. It looks like I'm headed in the same direction and will be giving up on IIS. - BinarySolo

1 Answers

1
votes

It's an old thread, but I found a solution that worked for me: It seems that in case the POST request exceeds 16kb of size, PHP is writing a kind of a cache file to its local temp directory. So check your PHP.ini file (upload_tmp_dir) and make sure the local group IIS_IUSRS has write permission to this directory.