skip to Main Content

I have a website where users can upload images to my hosting Apache/PHP server.
If files uploading lasts less than 20 sec everything is fine.
But if it lasts more (no matter what image filesize is), upload fails.

In .htaccess I already have:

php_value upload_max_filesize 10M
php_value post_max_size 70M
php_value max_execution_time 180
php_value max_input_time 180

And in php script, returng result of:

echo "-max_execution_time  ".ini_get('max_execution_time');
echo "-max_input_time ".ini_get('max_input_time');
echo "-upload_max_filesize  ".ini_get('upload_max_filesize');
echo "-post_max_size  ".ini_get('post_max_size');
echo "-memory_limit   ".ini_get('memory_limit');

is as excepted:

-max_execution_time  180

-max_input_time 180

-upload_max_filesize  10M

-post_max_size  70M

-memory_limit   128M

These are requests – all failed after 22sec with error net::ERR_SPDY_PROTOCOL_ERROR (in firefox they fail after 20sec)

https://cdn1.imggmi.com/uploads/2019/5/8/fadd31a1a22674cfc3cc4603c97762ff-full.jpg

console log

What I am missing here???
Once again, if uploading duration is less than 20 sec – everything is fine…

5

Answers


  1. Chosen as BEST ANSWER

    It was server problem due shared hosting and I had to contact hosting support...eventually they did some server reconfig and now upload does not break so early...thanks to @m908070 cheers


  2. Maybe This problem stems from “Timeout” Directive in apache httpd.conf file.

    See here: https://httpd.apache.org/docs/2.4/mod/core.html#timeout

    Login or Signup to reply.
  3. 20 seconds might mean that the Apache module mod_reqtimeout could be what’s killing your request since that is one of it’s defaults (20 seconds to receive request body) if it’s options are not configured.

    https://httpd.apache.org/docs/trunk/mod/mod_reqtimeout.html

    I believe that mod_reqtimeout is an extension loaded automatically with Apache 2.4

    Login or Signup to reply.
  4. I also encountered a similar problem at my apache2.4-rails-passenger-aws-ec2 project.
    When I upload a large file (over 500MB), it times out in about 20 seconds.

    I was trying to change apache’s Timeout related configuration, but it didn’t get better.

    I switched my application server from apache-passenger to thin, then uploading was no problem.
    Since this ask was posted recently, I thought that a recent release of apache had a problem.

    After all, I downgraded apache at executing following commands, it’s working properly.

    $ sudo yum list httpd24
    Installed packages
    httpd24.x86_64  2.4.39-1.87.amzn1
    $ sudo yum erase httpd24 httpd24-tools httpd24-devel
    $ sudo yum install httpd24-2.4.38-1.86.amzn1 httpd24-2.4.38-1.86.amzn1 httpd24-devel-2.4.38-1.86.amzn1
    

    After I read this ask’s answers, I re-upgrade apache to 2.4.39 and commented out the following line to disable mod_reqtimeout, it’s also working.

    # LoadModule reqtimeout_module modules/mod_reqtimeout.so
    

    I think the cause of the problem is in a change of apache through 2.4.38 to 2.4.39.

    Login or Signup to reply.
  5. turning off this module – its help

    LoadModule reqtimeout_module modules/mod_reqtimeout.so

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search