Voting

: max(nine, four)?
(Example: nine)

The Note You're Voting On

php nospace juju ta ggooggle mail
9 years ago
combining some ideas i was finally able to get a long running script to give me real time feedback on what it was doing. this was a wamp setup with php running as cgi. i'm pretty sure that apache just wasn't sending any of the buffered output because it was trying to be helpful. also trying to be helpful, i hope this example solution helps someone.

<?php
// thx mandor at mandor
ini_set('max_execution_time', 0);
ini_set('implicit_flush', 1);
ob_implicit_flush(1);

echo
'doing something'; my_flush();
sleep(5);
echo
'doing something else'; my_flush();
sleep(5);
echo
'finally done - hooray';

function
my_flush() {
// following matt at hevanet's lead
for ($i=0;$i<10000;$i++) echo ' ';
ob_flush();
flush();
}

<< Back to user notes page

To Top