阿帕奇不冲洗
我在 Linux 系统上使用 Apache 2.2.1 和 PHP 5.3.8。
我需要在调用开始时刷新标头,但浏览器会一直等待,直到交付完整内容。
在命令行上,使用“php test.php”一切都按预期工作,但一旦涉及 apache 就不行了。
我尝试了一切。设置output_buffer = Off,zlib.output_compression = Off,禁用mod_deflate,SendBufferSize 512。我也在php中使用了所有不同的刷新方法。但正如我所说,在命令行上它工作得很好。
以下是响应标头:
- Date Wed, 26 Oct 2011 16:37:07 GMT
- Server Apache/2.2.21 (Amazon)
- X-Powered-By PHP/5.3.8
- Connection close
- Transfer-Encoding chunked
- Content-Type text/html; charset=UTF-8
我删除了每个模块,除了这些:
- LoadModule authz_host_module module/mod_authz_host.so
- LoadModule ldap_module module/mod_ldap.so
- LoadModule log_config_module module/mod_log_config.so
- LoadModule setenvif_module module/mod_setenvif.so
- LoadModule mime_module module/mod_mime.so
- LoadModule达夫模块模块/mod_dav.so
- LoadModule autoindex_module 模块/mod_autoindex.so
- LoadModule dir_module 模块/mod_dir.so
- LoadModule alias_module 模块/mod_alias.so
- LoadModule rewrite_module 模块/mod_rewrite.so
我希望有人可以帮助我
I use a Apache 2.2.1 with PHP 5.3.8 on a Linux system.
I need to flush the header at the beginning of the call, but the browser keeps waiting until the full content is delivered.
On the command line, using "php test.php" everything works as expected but not as soon as apache is involved.
I tried everything. Setting the output_buffer=Off, zlib.output_compression=Off, disabled mod_deflate, SendBufferSize 512. I used all the different flush methods in php also. But as i said, on the command line it works fine.
Here is the response header:
- Date Wed, 26 Oct 2011 16:37:07 GMT
- Server Apache/2.2.21 (Amazon)
- X-Powered-By PHP/5.3.8
- Connection close
- Transfer-Encoding chunked
- Content-Type text/html; charset=UTF-8
I removed every module, except for these:
- LoadModule authz_host_module modules/mod_authz_host.so
- LoadModule ldap_module modules/mod_ldap.so
- LoadModule log_config_module modules/mod_log_config.so
- LoadModule setenvif_module modules/mod_setenvif.so
- LoadModule mime_module modules/mod_mime.so
- LoadModule dav_module modules/mod_dav.so
- LoadModule autoindex_module modules/mod_autoindex.so
- LoadModule dir_module modules/mod_dir.so
- LoadModule alias_module modules/mod_alias.so
- LoadModule rewrite_module modules/mod_rewrite.so
I hope there is someone who can help me
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
很可能 Apache 刷新得很好,但浏览器决定继续缓冲(而不是启动渲染)一段时间,即使在收到初始刷新的数据后也是如此。
来自文档:
除了特定于浏览器的黑客攻击(例如发送大量空格(几年前我不得不诉诸于此)以使浏览器“重新考虑”)之外,您实际上无能为力。
In all probability Apache is flushing just fine, but it's the browser the decides to continue buffering (and not starting render) for some time even after the initial flushed data has been received.
From the documentation:
There's nothing really you can do about that apart from browser-specific hacks such as sending lots of whitespace (I had to resort to that several years ago) to make the browser "reconsider".
您应该尝试发送带有其他
content-type
或不带有content-type
的页面。在我们的服务器中,我们遇到了类似的问题,我们发现当content-type
为 html 时,mod_security
会阻止刷新。You should try send the page with another
content-type
or withoutcontent-type
. In our server we had similar issue and we found out thatmod_security
blocks the flush when thecontent-type
is html.