PHP script not flushing output to browser, in dev server?

53 views
Skip to first unread message

Alex Kerr

unread,
May 27, 2016, 4:43:06 PM5/27/16
to Google App Engine
I've got a long running PHP script which does some processing and should be outputting text to the browser occasionally during it's runtime but it just seems to stack all the output up and display it at the end. I'm using ob_start(), ob_flush() and ob_end_flush so PHP definitely should be sending output to the webserver which I'm guessing is buffering it all. Is there an way to stop this from happening and just see the output during the script run?

Psuedocode is:

ob_start();
while(more-processing-to-do)
{
// do some processing
echo "Still processing<br>";
ob_flush();
}
ob_end_flush();

This is specifically for the dev server, I haven't been able to try online yet...

Nick (Cloud Platform Support)

unread,
May 31, 2016, 12:37:32 PM5/31/16
to Google App Engine
Hey Alex,

App Engine buffers output, as you observed, and waits for the response to complete before sending it. This is described in the documentation. You could look into using Compute Engine with a PHP runtime to get around this restriction. 

Cheers,

Nick
Cloud Platform Community Support
Reply all
Reply to author
Forward
0 new messages