Php – Receiving a 404 after posting a large file via PHP on IIS

iisPHPphp7

I have a form where you can upload an XML file and my PHP file parses and imports the file into a database. When I post a 50 mb or less file, it works. But when I post something a bit higher, it returns a "404 Page not found" from IIS. Why is this? Should it return a 500 error instead?..

Could not find anything in the Event Viewer and no error is returned or logged in the PHP error log. I'm lost.

Windows Server 2012
PHP 7.1.1
IIS Version 6.2 (Build 9200)

Best Answer

I had to increase the maxRequestLength and maxAllowedContentLength via the configuration editor in IIS.

These values can be found here:

Web.Config/system.web/httpRuntime/maxRequestLength  
Web.Config/system.webServer/security/requestFiltering/maxAllowedContentLength

To find these values in IIS:

  1. Click on your site
  2. On the "Feature View" under "Management", click "Configuration Editor"
  3. Use the "Section" drop down menu to navigate to the correct section

Source: https://stackoverflow.com/a/40085473/3208151

Related Topic