title: jQuery/PHP file upload restarts at 99% and then returns timeout
body: <p>I'm having some issues with jQuery/PHP file uploading on my AMI Linux running on EC2 instance.
  I tried using <a href="https://github.com/danielm/uploader" rel="nofollow noreferrer">this</a> and a couple other plugins (just to ensure the problem wasnt with the plugin itself), with the same results.
  When trying to upload a 14MB PDF the progress bar reaches 75% (or more, up to 99%), then it restarts from 0%, it reaches again 75% (or more, up to 99%) and then it just stops with no error (not even saying <code>Request Timeout</code>).
  Doing several attempts, only a couple of times the progress bar reached 99% without restarting, and then error popped up saying <code>Request Timeout</code>.
  This is what i found in apache's <code>access_log</code>:</p>
  <blockquote>
  <p>12.34.56.78 - - [02/Jul/2019:15:50:09 +0000] &quot;POST /uploader/demo/backend/upload.php HTTP/1.1&quot; 408 221</p>
  <p>12.34.56.78 - - [02/Jul/2019:15:50:31 +0000] &quot;POST /uploader/demo/backend/upload.php HTTP/1.1&quot; 408 221</p>
  </blockquote>
  <p>So it prints <code>408 Request Timeout</code> on 2 lines (infact the upload restarts once). The upload takes 22 or 23 seconds (as can be seen in the logs).</p>
  <p>This is how i set my <code>php.ini</code> (i'm using PHP 7.1 FPM):</p>
  <pre><code>max_execution_time = 360
  max_input_time = 360
  memory_limit = 256M
  post_max_size = 100M
  upload_max_filesize = 100M
  </code></pre>
  <p><code>phpinfo()</code> shows that those values are properly applied.
  I also tried to use <code>set_time_limit(0)</code> and set all above values in the <code>upload.php</code> file with <code>ini_set()</code>, but nothing changed.
  Upload directory has proper permissions, infact an 9.3MB PDF is uploaded correctly with no errors.</p>
  <p>In one of my attempts i tried also to set these apache directives:</p>
  <pre><code>KeepAlive On
  KeepAliveTimeout 360
  TimeOut 360
  </code></pre>
  <p>With the only result that the upload progress kept reaching 99% and restarting several times instead than restating only once.</p>
  <p>Now i run out of ideas and most solutions proposed are related to <code>php.ini</code> settings which in my case are properly applied.</p>