note 118116 added to function.flush
| From: | phpnospacejujutaggoogglemail | Date: | Tue, 06 Oct 2015 22:53:15 +0000 |
| Subject: | note 118116 added to function.flush | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-203919@lists.php.net to get a copy of this message | ||
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();
}
----
Server IP: 72.52.91.14
Probable Submitter: 71.203.235.197
----
Manual Page -- http://php.net/manual/en/function.flush.php
Edit -- https://master.php.net/note/edit/118116
Del: integrated -- https://master.php.net/note/delete/118116/integrated
Del: useless -- https://master.php.net/note/delete/118116/useless
Del: bad code -- https://master.php.net/note/delete/118116/bad+code
Del: spam -- https://master.php.net/note/delete/118116/spam
Del: non-english -- https://master.php.net/note/delete/118116/non-english
Del: in docs -- https://master.php.net/note/delete/118116/in+docs
Del: other reasons-- https://master.php.net/note/delete/118116
Reject -- https://master.php.net/note/reject/118116
Search -- https://master.php.net/manage/user-notes.php