nginx下flush失败的解决方法
在使用php编写定时任务时,需要flush刷新输出缓存,以便将实时输出结果显示给浏览器。 apache下没有问题,但是nginx下flush无效。那是因为nginx的配置默认开启了proxy_buffering和gzip。为了让php flush对实时内容有效,很少修改nginx的服务器配置。就个人而言,我会这样做。 nginx下php flush失败怎么处理? nginx下flush失败的解决方法很简单。只需要将下面的代码复制到页面头部即可解决php flush失败的问题。
set_time_limit(0);
ini_set('memory_limit','-1');
ob_end_clean();
ob_implicit_flush();
header('X-Accel-Buffering: no');
文章来源网络,作者:运维,如若转载,请注明出处:https://shuyeidc.com/wp/114756.html<