简体   繁体   English

在我的本地XAMPP服务器上禁用输出缓冲

[英]Disable output buffering on my local XAMPP server

For some reason my XAMPP server is buffering the output of my PHP. 出于某种原因,我的XAMPP服务器正在缓冲我的PHP输出。 I want it to spit it out as it goes. 我希望它随之吐出来。 Anyone any ideas which settings I need to change to achieve this? 任何想法,我需要改变哪些设置才能实现这一目标?

Check out ob_end_flush() , the manual's chapter on output control - specifically the php.ini settings . 查看ob_end_flush() ,关于输出控件的手册章节 - 特别是php.ini设置

Of course if you're just getting a blank page, check your error reporting settings - it's very possible an error halts the script, and with error reporting off you see nothing. 当然,如果你只是得到一个空白页面,检查你的错误报告设置 - 很可能一个错误停止脚本,并且错误报告关闭你什么也看不见。

XAMPP appears to set output_buffering to 4096 by default. XAMPP似乎默认将output_buffering设置为4096。 (So content is served in 4K chunks - a possible performance benefit. Although this can lead to unexpected bugs (eg. "headers already sent" etc.) if deploying on a server where this is disabled, which incidentally is the PHP default.) (因此内容以4K块的形式提供 - 可能带来性能优势。虽然这可能导致意外错误(例如“已发送标头”等),但如果在禁用此服务器的服务器上进行部署,则默认情况下是PHP默认情况。)

In php.ini : php.ini

; Default Value: Off
; Development Value: 4096
; Production Value: 4096
; http://php.net/output-buffering
output_buffering=4096

Set to: 调成:

output_buffering=Off

And restart your server. 然后重新启动服务器。

if you are debugging this in Xdebug and checking the output in the browser there might several reason for that. 如果你在Xdebug中调试它并在浏览器中检查输出,可能有几个原因。 1) php 2) apache (web server) 3) Web browser 1)php 2)apache(web服务器)3)Web浏览器

Read this for the detailed information: 阅读本文了解详细信息:

http://muzso.hu/2008/02/19/php-output-buffering http://muzso.hu/2008/02/19/php-output-buffering

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM