php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #9031 ob_gzhandler memory leak and Headers already sent message!
Submitted: 2001-01-31 09:15 UTC Modified: 2001-06-14 14:49 UTC
From: aboldt at boldtconsult dot com Assigned: andre (profile)
Status: Closed Package: Output Control
PHP Version: 4.0.4pl1 OS: Linux 2.2.18
Private report: No CVE-ID: None
 [2001-01-31 09:15 UTC] aboldt at boldtconsult dot com
When enabling output_handler = ob_gzhandler in php.ini, my Linux system starts to eat more and more memory in an unusual way, like there was a memory leak, like many people have reported.

But what is absolutely weird is that after enabling ob_gzhandler, I start to get this error messages in my log files:

Cannot add header information - headers already sent in Unknown on line 0

Which is weird, because one of the features of output buffering is to avoid that kind of problems. What's even more weird is that I don't get any "headers already sent" messages with output_handler = ob_gzhandler disabled!

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-02-01 20:03 UTC] sniper@php.net
This should be fixed in CVS now. Please try the latest CVS snapshot from http://snaps.php.net/ and reopen this bug report if problem still exists when
using it.

--Jani

 [2001-02-02 09:23 UTC] aboldt at boldtconsult dot com
Tried the php4-200102020545 snapshot and I still get the

httpd: PHP Warning:  Cannot add header information - headers already sent in Unknown on line 0

error message when enabling output_handler = ob_gzhandler.
This probably still causes a memory leak.

Found another interesting thing: when trying to see the headers of a ob_gzhandler compressed page with lynx, I get the following lynx error message:

Can't access startfile http://localhost/test.php

That's using lynx -head -source http://localhost/test.php. Seems lynx sees something which it doesn't like. With ob_gzhandler disabled, I get the normal http headers when invoking that lynx command.
 [2001-02-06 15:33 UTC] aboldt at boldtconsult dot com
I've just found out what the problem is, and it's kind of weird:
With ob_gzhandler enabled (from php.ini or with ob_start("ob_gzhandler") in the .php) each readfile() makes the "Cannot add header information - headers already sent" error message appear.
This doesn't happen with output buffering enabled and no ob_gzhandler, it only happens with ob_gzhandler enabled.

Also tried to replace readfile with fpassthru(fopen()) but got the same result.

Hope this helps you fix the problem.

If you have any questions feel free to ask, I've been experimenting quite a lot.
 [2001-02-19 23:02 UTC] andre@php.net
similar Bug id #9231

 [2001-02-20 06:40 UTC] thies@php.net
both problems are fixed in CVS

 [2001-02-20 10:43 UTC] aboldt at boldtconsult dot com
The headers already sent message with ob_gzhandler enabled problem is solved.

However, the lynx -head problem is still there.
 [2001-06-14 14:34 UTC] sniper@php.net
Can't reproduce on PHP 4.0.6RC3

http://www.php.net/~andi/php-4.0.6RC3.tar.gz

 [2001-06-14 14:49 UTC] aboldt at boldtconsult dot com
Problem has already been solved in php 4.0.5.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sun Jan 26 08:01:24 2020 UTC