note 85383 added to function.ob-flush
| From: | Lucas at osu1 dot php dot net | Date: | Wed, 27 Aug 2008 22:13:27 +0000 |
| Subject: | note 85383 added to function.ob-flush | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-143902@lists.php.net to get a copy of this message | ||
I just had some problems with flush() and ob_flush(). What I did to resolve this problem took me
some time to figure out so I'd like to share what I came up with.
The main problem is the php setting "output_buffering" which can be set too large and will
prevent your text from outputting. To change this value you can either set it in php.ini or you can
add the line
php_value output_buffering "0"
to your .htaccess file. It will not work with ini_set() since it is PHP_INI_PERDIR.
Next thing is to begin with ob_start();
Then you need
ob_flush();
flush();
before any echo or print.
Your code might look like this:
<?php
ob_start();
for($i=0;$i<70;$i++)
{
echo 'printing...<br />';
ob_flush();
flush();
usleep(300000);
}
?>
Hope this helps anyone with the same problems.
----
Server IP: 212.63.193.10
Probable Submitter: 213.114.185.215
----
Manual Page -- http://www.php.net/manual/en/function.ob-flush.php
Edit -- https://master.php.net/note/edit/85383
Del: integrated -- https://master.php.net/note/delete/85383/integrated
Del: useless -- https://master.php.net/note/delete/85383/useless
Del: bad code -- https://master.php.net/note/delete/85383/bad+code
Del: spam -- https://master.php.net/note/delete/85383/spam
Del: non-english -- https://master.php.net/note/delete/85383/non-english
Del: in docs -- https://master.php.net/note/delete/85383/in+docs
Del: other reasons-- https://master.php.net/note/delete/85383
Reject -- https://master.php.net/note/reject/85383
Search -- https://master.php.net/manage/user-notes.php