I just moved my website to GoDaddy hosting, and got everything working, but the PHP scripts aren't outputting the data immediately -- they're buffering until the script is finished running, and then rendering the whole page at once. And obviously, for long scripts, that's a problem. It didn't used to run that way with my old host, and GoDaddy support says they can't help with this. Here's what I've already tried (without any success)
- Disabled output compression (zlib, gzip)
- Set
output_buffering = off
in php.ini - Set headers for
Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
,Pragma "no-cache"
,Expires "Wed, 10 May 1985 09:00:00 GMT"
, and unset theETag
header - I also tried setting the buffering values in the script itself, using
ini_set('output_buffering', 'off')
,ini_set('zlib.output_compression', false)
,while (@ob_end_flush())
,ini_set('implicit_flush', true)
, andob_implicit_flush(true)
- And I tried running
flush()
andob_flush()
commands after everyecho
output - Tried changing the PHP version from the default (5.4 native, which has APC enabled) to 5.4 non-native and 5.5
I also created a test script that simply loops for 5 iterations and outputs a line at every iteration, then waits a second before the next iteration. I did this to eliminate any other possible causes of problems. But no matter what I do, the script always waits until it completes before starting to render.
So, is there anything that I can do to make it work properly?
ob_flush
andflush
don't work, there might be more going on. Perhaps a reverse proxy or something. – Alexander O'Mara