Disable output buffering on my local XAMPP server

14,513

Solution 1

XAMPP appears to set output_buffering to 4096 by default. (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.)

In 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.

Solution 2

Check out ob_end_flush(), the manual's chapter on output control - specifically the php.ini settings.

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.

Share:
14,513
Mark
Author by

Mark

Updated on June 13, 2022

Comments

  • Mark
    Mark 6 months

    For some reason my XAMPP server is buffering the output of my PHP. I want it to spit it out as it goes. Anyone any ideas which settings I need to change to achieve this?

    • Armand
      Armand over 7 years
      Did you force flush() in your code to see the output being sent to your screen?
    • Félix Adriyel Gagnon-Grenier
      Félix Adriyel Gagnon-Grenier over 7 years
      add ini_set('display_errors',1);error_reporting(E_ALL); at the top of your script
  • Mark
    Mark over 12 years
    I checked in the php.ini output buffering is off and ob_end_flush does not give an output... could anything else be stopping my script from echoing during execution?
  • Tim Lytle
    Tim Lytle over 12 years
    If you're using some kind of framework, it maybe setting up output buffering regardless of the settings. If all you get is a blank page, check error reporting. Any example code/output?