PHP connection_aborted doesn't work with nginx?

Posted by TheOnly92 on Stack Overflow See other posts from Stack Overflow or by TheOnly92
Published on 2010-05-22T12:45:37Z Indexed on 2010/05/22 12:50 UTC
Read the original article Hit count: 215

Filed under:
|

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

<?php
ignore_user_abort(true);
ob_implicit_flush();
$i = 0;
while (!connection_aborted()) {
    echo $i;
    $i++;
    sleep(1);
}
file_put_contents('test',$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.

© Stack Overflow or respective owner

Related posts about php

Related posts about nginx