I have a PHP script that does some data processing. The time that it takes to the script to finish all the job is based on the user input. It's not unusual that it takes 5-15 minutes of processing.
On apache everything works fine, however on Nginx the connection just got closed. When the processing time is low, everything is fine. The problem comes on the long requests...
There is no error in none of the logs. I suspect that the browser closes the connection.
I sniffed the headers, and it appears that Nginx doesn't send any response, until the processing is done. Not a single header.
I tried sending headers from the script, but it seems that nginx caches them all.
Afterwards, I disabled PHP output buffering and enabled implicit flush. I disabled gzip compression and zlib. I minimize FAST_CGI_BUFFERS to the minimum allowed, which is: fastcgi_buffers 2 1k; fastcgi_buffer_size 1k; fastcgi_busy_buffers_size 1k; fastcgi_max_temp_file_size 0;
Still, it refuse to send headers...
So just to prove my case, in one of the loops inside the code, I did a var_export to one of the objects...
BOOM!!! - it works...
Can anyone think of a more elegant solution?
Update August 19th
Something crazy is going on. After I tried debugging it for 2 full days without any luck, I tried something I should've done before.
I tried this config on Linode, and it works!!!
So probably the problem is somewhere in Ubuntu config... Have no idea where to look.