duanchi6397 2010-05-22 12:45
浏览 107
已采纳

PHP connection_aborted不能与nginx一起使用?

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.

  • 写回答

2条回答

  • dongpai1942 2010-05-23 16:11
    关注

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 很想要一个很好的答案或提示
  • ¥15 扫描项目中发现AndroidOS.Agent、Android/SmsThief.LI!tr
  • ¥15 怀疑手机被监控,请问怎么解决和防止
  • ¥15 Qt下使用tcp获取数据的详细操作
  • ¥15 idea右下角设置编码是灰色的
  • ¥15 全志H618ROM新增分区
  • ¥15 在grasshopper里DrawViewportWires更改预览后,禁用电池仍然显示
  • ¥15 NAO机器人的录音程序保存问题
  • ¥15 C#读写EXCEL文件,不同编译
  • ¥15 MapReduce结果输出到HBase,一直连接不上MySQL