ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> phpdoc
phpdoc
[PHP-DOC] #25304 [Opn]: Implicit flush output in CLI falsely documented
by other posts by this author
Nov 2 2003 2:29PM messages near this date
[PHP-DOC] #25304 [Opn->Csd]: Implicit flush output in CLI falsely documented | [PHP-DOC] #25304 [Bgs->Opn]: Implicit flush output in CLI falsely documented
ID:               25304
 Updated by:       betz@[...].net
 Reported By:      eru@[...].net
 Status:           Open
 Bug Type:         Documentation problem
 Operating System: Linux RH 8.0
 PHP Version:      4CVS-2003-08-28 (stable)
 New Comment:

php -r 'var_dump(ini_get("implicit_flush")); echo "test\n"; while 
(1);' 
 
doesn't output anything, even as implicit_flush is set to 1 in 
php-cli.ini. 
It seems only -n switch solves the problem, providing a php.ini 
with cli specific settings doesn't solve the flush prob.  
 
Is this the desired behaviour?  
(testing with 4.3.2, RH8) 
 


Previous Comments:
------------------------------------------------------------------------

[2003-09-08 18:50:02] eru@[...].net

Ok, then this is an error in the documentation.
The quoted paragraph should get removed alltogether, as it is plain
wrong.

------------------------------------------------------------------------

[2003-09-08 15:48:00] iliaa@[...].net

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

To avoid this problem use php-cli.ini with settings specific to CLI.

------------------------------------------------------------------------

[2003-08-28 15:49:48] eru@[...].net

Description:
------------
From http://de.php.net/manual/en/features.commandline.php:

"It is desired that any output coming from print(), echo() and friends
is immediately written to the output and not cached in any buffer. You
still can use output buffering  if you want to defer or manipulate
standard output."

Right, that's exactly what you expect, when using CLI, but this only
works as long, as you don't have a php.ini, where output_buffering is
enabled. The unfortunate thing is only, you can't change it in your
script, because it's not PHP_INI_USER. The only way out, is either
creating a php.ini for CLI only, which hardly every installation has,
by declaring -n in your commandline, which isn't desirable either, when
you rely on certain settings in php.ini or by passing a -d
output_buffering=0 on the commandline, but I wasn't able to achieve
this in a #!/usr/local/bin/php line at the top of the script.

So, what we have here in my opinion is a contradictory situation,
because implicit_flush = 1 is overruled by outbut_buffering = 4096.


Reproduce code:
---------------
<?php
var_dump(ini_get("implicit_flush"));
sleep(2);
?> 



Expected result:
----------------
string(1) "1"
<2 seconds of waiting> 

Actual result:
--------------
<2 seconds of waiting> 

string(1) "1"



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=25304&edit=1
Thread:
eru@php.net


eru@php.net


Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved