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 lammps拉伸应力应变曲线分析
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题
  • ¥30 python代码,帮调试,帮帮忙吧
  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python