PHP is starting output buffering automatically for you and then you are
starting it in your script as well, that is why you are receiving the
message ob_gzhandler can not be used twice.
Use ob_get_level to check if output buffering is not already started.
<?php
// start output buffering if it is not already running
if (0 == ob_get_level()) {
ob_start('ob_gzhandler');
}
?>
You may want additional logic that checks to see if the output buffer
hander is ob_gzhandler.
Jsaon
On Fri, 2003-02-21 at 17:12, Gerard Samuel wrote:
> I noticed this problem with one of my scripts when its running under php
> 4.3.0, Apache 2.0.44.
> It only happens when started with ob_start('ob_gzhandler');
> Even with this test script from the php manual produces this error.
> Any insight would be appreciated.
>
>
> From php.ini ->
> ; Output buffering allows you to send header lines (including cookies) even
> ; after you send body content, at the price of slowing PHP's output layer a
> ; bit. You can enable output buffering during runtime by calling the output
> ; buffering functions. You can also enable output buffering for all
> files by
> ; setting this directive to On. If you wish to limit the size of the buffer
> ; to a certain size - you can use a maximum number of bytes instead of
> 'On', as
> ; a value for this directive (e.g., output_buffering=4096).
> output_buffering = 4096
>
> ; You can redirect all of the output of your scripts to a function. For
> ; example, if you set output_handler to "mb_output_handler", character
> ; encoding will be transparently converted to the specified encoding.
> ; Setting any output handler automatically turns on output buffering.
> ; Note: People who wrote portable scripts should not depend on this ini
> ; directive. Instead, explicitly set the output handler using
> ob_start().
> ; Using this ini directive may cause problems unless you know what
> script
> ; is doing.
> ; Note: You cannot use both "mb_output_handler" with "ob_iconv_handler"
> ; and you cannot use both "ob_gzhandler" and
> "zlib.output_compression".
> ;output_handler =
>
> ; Transparent output compression using the zlib library
> ; Valid values for this option are 'off', 'on', or a specific buffer size
> ; to be used for compression (default is 4KB)
> ; Note: Resulting chunk size may vary due to nature of compression. PHP
> ; outputs chunks that are few handreds bytes each as a result of
> compression.
> ; If you want larger chunk size for better performence, enable
> output_buffering
> ; also.
> ; Note: output_handler must be empty if this is set 'On' !!!!
> ; Instead you must use zlib.output_handler.
> zlib.output_compression = Off
>
> ; You cannot specify additional output handlers if zlib.output_compression
> ; is activated here. This setting does the same as output_handler but in
> ; a different order.
> ;zlib.output_handler =
>
> -----------------------------------
> Example script ->
>
> <?php
>
> ob_start("ob_gzhandler");
>
> ?>
> <html>
> <body>
> <p>This should be a compressed page.
> </html>
> <body>
>
> ---------------------------------
> Error reported ->
>
> This should be a compressed page.
> Warning: (null)() [ref.outcontrol]: output handler 'ob_gzhandler' cannot
> be used twice in Unknown on line 0
>
> --
> Gerard Samuel
> http://www.trini0.org:81/
> http://test1.trini0.org:81/
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php