PHP Connection Reset on Large File Upload Regardless Correct Setting

Heru S picture Heru S · Sep 27, 2011 · Viewed 9.4k times · Source

I am having a very common problem which it seems that all the available solutions found are not working.

We have a LAMP server which is receiving high amount of traffic. Using this server, we perform a regular file submission upload. On small file uploads, it works perfectly. On files of around 4-5MB, this submission upload failed intermittently (sometimes it works but many times it failed).

We have the following configuration on our PHP:

max_input_time: 600
max_execution_time: 600
max_upload_size: 10M
post_max_size: 10M

Apache setting:

Timeout: 600
Keep-Alive Timeout: 15
Keep-Alive: On
Per Child: 1000
Max Conn: 100

Thus, I wonder if anyone can help me with this. We have found the issues and solutions online but none of them work in our case.

Thank you so much. Any input / feedback is much appreciated!

Answer

user1074324 picture user1074324 · Dec 1, 2011

The connection coud be terminating at several places:

  1. Apache
  2. Post size limit inside of php.ini
  3. Memory limit inside of php.ini
  4. Input time limit inside of php.ini
  5. Execution time limit inside of php.ini or set_time_limit()

I would increase all of these, and see if it still persists. But you will have to bounce apache for the changes inside of php.ini to take affect.

These are also affected by what kind of connection speed the end user has, if it is failing for certain users, it's because their connection is slower than others, and their connection with the server is terminating.