php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20015 session.auto_start diables flushing output
Submitted: 2002-10-21 16:13 UTC Modified: 2002-10-22 20:40 UTC
From: amir at abiri-e dot com Assigned:
Status: Wont fix Package: Output Control
PHP Version: 4.2.3 OS: Linux Redhat 7.2
Private report: No CVE-ID: None
 [2002-10-21 16:13 UTC] amir at abiri-e dot com
I'm not sure this is indeed a bug, I tried looking for some piece of documentation about this, but failed.

I wrote a script that used the flush() command and it failed to operate correctly. knowing the many possible pitfalls around output buffering, and since the role of the script is a web-crawler anyway, I moved it to the cli version, yet the problem persisted - the script (which is meant to work for hours) refuses to flush it's output, no matter what I did.


After going over the ini file line by line commenting and uncommenting, I found that "session.auto_start = 1" causes php to fail any form of output buffer flushing: flush(), ob_flush() and implicit_flush directive, even with the cli sapi.

I don't want to duplicate the ini file, therefore I would be happy to find a way to keep the apache module with session.auto_start=1, yet overcoming this issue, so to be able to flush my output, at least in cli scripts.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-10-21 16:21 UTC] amir at abiri-e dot com
also setting "-d session.auto_start=0" in the binary command line in the first line of the script doesn't solve the problem, yet doing so when calling the script in the "php [script name]" form from the shell does. in both cases setting the entry in the ini file solves the problem completely.
 [2002-10-22 01:37 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-latest.zip
 [2002-10-22 03:43 UTC] yohgaki@php.net
Attempt that enables output buffers flushing is rejected, so it won't fix.
 [2002-10-22 11:03 UTC] amir at abiri-e dot com
So this is indeed a bug ? Great.

In the meanwhile, for anyone else who is expiriencing the same problem I recommand the solution I found for myself, until more light is shed on this issue. When you configure before the compilation, use the --with-config-file-path=[path] switch, and compile the apache module with let's say /etc/php/apxs/ and the cli binary with /etc/php/cli/.
That way you can tweak the configuration independently for each build, and disable things for the cli without interfering with the web server's work.
 [2002-10-22 20:40 UTC] yohgaki@php.net
Your output is buffered since there is "trans sid" buffer due to sessoin_auto_start=1. It prevents output buffer flushing.

BTW, there is flush function called ob_flush(). It differs from flush(). However, ob_flush() is also broken from the beginning and it will _not_ be fixed. So don't use it.

Don't try to use ob_implicit_flush() to flush output buffer, it does not flush output buffer, but SAPI buffer. It will _not_ help to output buffer flushing at all.

flush() try to flush web server buffer and it does not help flushing output buffer contents at all.

If need to direct output, don't use buffers. i.e. don't use trans sid, char encoding tranlation, zlib output compression, ob_gzhandler compression, etc, etc.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 30 14:01:28 2024 UTC