5

I have a Windows 2012 R2 Server running PHP 7.1 Hosting a Wordpress on IIS7

The default upload size for WordPress media library was 2MB, I was able to change this via php.ini to 512MB. But when uploading large files, especially over about 70MB the upload starts and then pauses and hangs in the middle. After the server times-out, I then get the WordPress HTTP error. net::ERR_CONNECTION_RESET on the inspect console.

This timeout Happens within the range of 10 - 20 seconds of the upload's start, and in a different production environment, this happens instantly.

Wordpress Error Console Error

I have done a lot of searching and created a new environment with a new WordPress on a windows setup but ran into the same issue on a Windows 2007 SP2 Setup.

Inside wp-config.php

@ini_set( 'upload_max_size' , '512M' );
@ini_set( 'post_max_size', '512M' );
@ini_set( 'memory_limit', '1024M' );
@ini_set( 'max_execution_time', '300' );

inside web.config

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.web>
    <httpRuntime executionTimeout="3600" maxRequestLength="1048576" requestLengthDiskThreshold="1048576"/>
    <identity impersonate="true"/>
  </system.web>
  <system.webServer>
    <security>
      <requestFiltering>
        <requestLimits maxAllowedContentLength="1073741824"></requestLimits>
      </requestFiltering>
    </security>
    <rewrite>
      <rules/>
    </rewrite>
  </system.webServer>
</configuration>

inside php.ini

upload_max_filesize = 512M
post_max_size = 512M
memory_limit = 1024M
max_execution_time = 300

on the IIS control panel Site Application Advanced Settings

Not sure what else can be done to fix this. The error shows up on a basic WordPress install with the basic theme.

Nmk
  • 1,281
  • 2
  • 14
  • 25
vico
  • 2,152
  • 2
  • 17
  • 38
  • Have you tried to clear your cache? [See this answer for more information:](https://stackoverflow.com/questions/24931566/getting-error-in-console-failed-to-load-resource-neterr-connection-reset) – Abdush Samad Miah Dec 13 '17 at 10:09
  • @AbdushSamadMiah cache? why would cache cause this? I have restarted the machine a few times. – vico Dec 13 '17 at 20:19
  • Could you please give back the error code (404 ?) with its iis substatus ? – Oulalahakabu Dec 14 '17 at 11:17
  • Try setting the `post_max_size` bigger than the upload if you or a user does upload a 512MB file there is no room for any other form information so i normally set the is 2 or 5 mb higher than the max post-size limit but this wont fix your problem just a bit of advice. what will is that IIS has it's own file size limit before PHP kicks in checkout http://ajaxuploader.com/large-file-upload-iis-asp-net.htm – Barkermn01 Dec 18 '17 at 13:51
  • @MartinBarker The problem is it errors much sooner than it even reach any cap. – vico Dec 18 '17 at 16:23
  • @Oulalahakabu The server Timeouts with no response back. – vico Dec 18 '17 at 16:24
  • @vico you would be surprised the upload limit is is only 28.61 MB by default so you could be hitting that upload limit rather fast. hell, my home broadband connection would hit that limit it about 4 seconds. and standard home broadband would hit that limit in about 18 seconds at 2Mb – Barkermn01 Dec 18 '17 at 16:33
  • @MartinBarker Like i stated above, I have done a local upload of 500 mb no problem, so it shouldn't be a size limitation. – vico Dec 18 '17 at 17:48

2 Answers2

1

This is caused by the fact that the IIS Web Server has it's own Upload/content size limit before PHP is enabled for the connection so setting the PHP stuff controls it for PHP but not for IIS.

you can read about it and how to fix at http://ajaxuploader.com/large-file-upload-iis-asp-net.htm

The Jist of it is add

<system.webServer>
  <security>
    <requestFiltering>
      <requestLimits maxAllowedContentLength="536870912" />
    </requestFiltering>
  </security>
</system.webServer>

To a web.config in the public or root directory of your site. Where the maxAllowedContentLength attribute is the number of bytes of your 'post_max_size' in the case of 512MB (512*1024*1024) = 536870912

Barkermn01
  • 6,781
  • 33
  • 83
0

This might be a long shot, but something like this happened to us (windows w/ IIS running PHP). Took forever to figure out and I couldn't believe it when I found it.

With that said, try clearing your Windows temp Directory (C:\Windows\Temp). PHP stores session files there that often don't get deleted. If they grow to be too many it can cause the issue you are describing. No guarantees, of course, but worth a shot.

Dan
  • 11
  • 4