PHP刷新停止了IIS7.5中的刷新 [英] PHP flush stopped flushing in IIS7.5

查看:76
本文介绍了PHP刷新停止了IIS7.5中的刷新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们一直在使用php flush在单击页面后立即清空"页面,并且还发送页面的导航和主要组件,使页面几乎立即显示,即使有时内容可能会占用加载时间很长.

We have been using php flush to "blank" a page immediately as soon as it is clicked, and also to send the navigation and main components of the page so that a page appears nearly instantly, even though sometimes the content may take a long time to load.

这一直很好.

最近,我们从IIS 7.0升级到7.5,现在刷新不起作用.在调查问题时,我们已关闭了静态文件和动态文件的压缩.我们还关闭了输出缓存.

Recently we upgraded from IIS 7.0 to 7.5 and now flush does not work. While investigating the problem we have turned off compression for both static and dynamic files. We have also turned off output caching.

我们还关闭了zlib压缩,并在php.ini中关闭了输出缓冲.

We also have zlib compression turned off and output buffering off in php.ini.

为了测试问题,我们有以下脚本

In order to test the problem we have the following script

@ini_set("output_buffering", "Off");
@ini_set('implicit_flush', 1);
@ini_set('zlib.output_compression', 0);

ob_start();

echo "starting...<br/>\n";
for($i = 0; $i < 5; $i++) {
    print "$i<br/>\n";
    ob_end_flush(); 
    ob_flush();
    flush();
    ob_start();
    sleep(2);
}
print "DONE!<br/>\n";

浏览器仅显示加载状态10秒钟(无论使用哪种浏览器,在IE中它看起来像是Ajax动画gif,在Firefox中,该标签会显示正在连接..."),然后突然显示整个加载状态输出出现.

The browser just shows the loading status (whatever that is in any browser, in IE it looks like an Ajax animated gif, in Firefox the tab will say "Connecting...") for 10 seconds, and then suddenly the entire output appears.

我们已基于此站点上的类似问题尝试了flush和ob_flush以及ob_end_flush的各种组合.他们都不工作.有什么方法可以使IIS/PHP刷新数据?

We have tried various combinations of flush and ob_flush and ob_end_flush based upon similar questions on this site. None of them work. Is there any way to make IIS/PHP flush the data?

推荐答案

您必须将所需处理程序的ResponseBufferLimit值设置为足够低的数字,以使其实际刷新.我建议使用0,因为它阻止IIS除了传递PHP脚本发送的内容之外,什么都不做. 您可以使用以下命令行将php处理程序的ResponseBufferLimit设置为0(只需将"NAME"更改为要更新的处理程序的名称,例如PHP53_via_FastCGI):

You must set the ResponseBufferLimit value of the desired handler to a number low enough to actually flush. I recommend using 0 since it prevents IIS from doing anything but passing along what you send it from your PHP script. You can use the following command line to set the ResponseBufferLimit to 0 for the php handler (just change "NAME" to the name of the handler you want to update e.g. PHP53_via_FastCGI):

appcmd.exe set config /section:handlers "/[name='NAME'].ResponseBufferLimit:0"

或者,您可以直接编辑applicationHost.config并在XML元素中添加ResponseBufferLimit属性.

Alternatively, you can edit the applicationHost.config directly and add a ResponseBufferLimit attribute the XML element.

这篇关于PHP刷新停止了IIS7.5中的刷新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆