Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ajax request returns "error 500", php script still working

A thing is, a user clicks a button, it starts an AJAX request (not so important). This ajax request calls a php script, which downloads and subsequently uploads a large file (php script should run probably 4 minutes); and naturally, a user "waits" for ajax response to tell him everything is all right.

However, after 130 seconds, this ajax request returns a response with a status code "500 Internal server error". However, no. 2; in the backend, the php script is still running ( i know that from the log records, which it creates).

Where can be problem?

  • max_execution_time does not affect it, since php script is still running
  • on localhost, everything is all right, this happens only on our production server
  • memory_limit does not affect it, (php script still running)
  • jquery ajax timeout does not affect it (by default, there is no timeout, i also set timeout 300 seconds, but no effect :( )

i am welcome to any ideas, how to resolve this

EDIT: caused by fastCGI idle timeout

like image 876
Ivan Hanák Avatar asked May 21 '26 02:05

Ivan Hanák


1 Answers

Can you add error function also in your ajax request?

$.ajax({
   type: "POST",
   url: "yourpublicfunction",
   success: function(response){},
   error: function(response){
      console.log(response.responseText);
   }
});

so that you can see in the browser console log what your web method returns,

like image 76
n00bster Avatar answered May 22 '26 16:05

n00bster



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!