TheOnly92 TheOnly92 - 1 year ago 201
PHP Question

PHP connection_aborted doesn't work with nginx?

I can't seem to get the function connection_aborted to work with nginx. The code I used to test is as follow:

$i = 0;
while (!connection_aborted()) {
echo $i;

In Apache, it works correctly, although it delays a little. i.e. When I press stop button on browser when "3", the 'test' file shows "8". That is an acceptable margin, but on nginx, it doesn't seem to output anything to the 'test' file.

Answer Source

Check your Nginx configuration, it should have

fastcgi_ignore_client_abort off;

This configuration key has off as the default, so even if you have no fastcgi_ignore_client_abort at all, your script should work as expected.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download