ID: 16676 Comment by: mark at gether dot org dot uk Reported By: norny at yahoo dot com Status: Wont fix Bug Type: Output Control Operating System: Slackware 8.0 PHP Version: 4.2.0 New Comment:
Greetings, i too have ob flushing turned on in php.ini yet i have a situation where i need to disable output buffering only for this script, after reading this page and trying a few things i have actually managed to do it, so i'm posting hopefully to help others trying to get their pages to have output buffering off even though its on in php.ini. I got it working using the .httpd.conf method... Firstly: edit httpd.conf and change .htaccess Allow Override setting to All (or specific) then restart apache. now, in the folder the script is in add .htaccess file in there put PHP_FLAG output_buffering Off then make a script: eg: <?php echo "INI:".ini_get('output_buffering')."<BR>"; ob_end_flush(); for($x=0; $x<5; $x++){ echo "X:$x <BR>\n"; flush(); sleep(1); } echo "\n<BR>done"; ?> hit the page, you should see it appear line by line Previous Comments: ------------------------------------------------------------------------ [2003-04-13 22:16:21] lize at tsinghua dot org dot cn I found a solution: set output_buffering = 0 in php.ini then ob_implicit_flush() does its work as it's assumed. //using Internet Explorer 6.0 Interesting? ------------------------------------------------------------------------ [2003-04-13 22:02:35] lize at tsinghua dot edu dot cn I've met the same problem as norny under apache1.3.20/php4.3.1(cli) I read throughly through the list, and felt that the ob_implicit_flush question was not clearly responsed. //maybe I'm wrong. I need to let ob_implicit_flush do its work as its statement in the manual or other requirements needed to let it work properly. ------------------------------------------------------------------------ [2003-01-11 17:32:11] [EMAIL PROTECTED] As of PHP 4.3.0 you can use an alternative php.ini named: php-{sapi}.ini, where {sapi} is the name of the sapi you are using. So, for the cli, php will look for php-cli.ini before it tries php.ini. For cgi it will look for php-cgi.ini etc. ------------------------------------------------------------------------ [2003-01-11 17:27:35] norny at yahoo dot com We don't seem to be communicating very well. I've been wanting to shut off buffering this whole time. Your suggestion to not buffer if I don't need it is just telling me what I already want to do. I've been trying to use the functions documented in the manual that are supposed to shut it off, but they have a big "Won't fix" label on them in the bug database. How about if I word it differently. I want the default buffer handling set in php.ini for my webpage output, but I don't want buffers for my command line scripts. I want those to output something to STDOUT as soon as it comes to a echo/print. If I don't use ob_end_flush, ob_implicit_flush, or ini_set, then what should I use to turn off buffering in my command line scripts. ------------------------------------------------------------------------ [2003-01-11 17:08:45] [EMAIL PROTECTED] And don't forget that some buffers should never be deleted once it's started. The error message is raised, since some users don't know it shouldn't. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/16676 -- Edit this bug report at http://bugs.php.net/?id=16676&edit=1