I get no output at all.
All DoCache does is write $buffer to a file then return $buffer since I use
this for some other serverside caching to save on database hits.
I have other areas that I call ob_start("ob_gzhandler") and that works fine
but when I call in via DoCache it breaks.
I much prefer your idea of mod_deflate. I will look into that since I
believe that belongs in apache rather than a PHP program also.
I am still curious why it doesn't work though.
Here is my "True" DoCache function:
function docache ($buffer) {
$fp=fopen(cachefilename(), "w");
if($fp)
fputs($fp,$buffer);
return ob_gzhandler($buffer);
}
cachefilename() simply returns an MD5 of the requested URI.
This will return a blank webpage in IE and Mozilla. When I take out
ob_gzhandler it then works fine.
Thanks,
Serge.
----- Original Message -----
From: "Ernest E Vogelsinger" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, November 08, 2002 4:00 AM
Subject: Re: [PHP] ob_gzhandler
> At 07:45 08.11.2002, Serge Paquin said:
> --------------------[snip]--------------------
> >Hello,
> >
> > Is their anyway to use ob_gzhandler along with another callback?
I've
> >tried the following which does not work:
> >
> >function DoCache($buffer) {
> > /* Do a bunch of stuff */
> > return ob_gzhandler($buffer);
> >}
> >
> >ob_start("DoCache");
>
> What do you mean by "does not work"? Does it output "nothing", or can't
you
> see any compressed data?
>
> 1) output is empty
> Must be an error in your DoCache() function - check the buffer you're
> passing to ob_gzhandler() by writing it to a file (you can't echo it
here...)
>
> 2) you don't see compressed output
> 2.a) That's how it is designed. ob_gzhandler checks the request headers to
> see if the browser supports any of the compressed formats (gzip, deflate),
> and if it doesn't find it then it simply does nothing.
> 2.b) PHP needs to be compiled using --with-zlib to provide ob_gzhandler
> support. You don't get any error if you don't have zlib configured. Check
> phpinfo() to see if zlib support is available.
>
>
> Personal hint:
> If you're using the url_rewriter.tags and have session cookies disabled,
> ob_gzhandler will break this. The reason is that PHP parses the
> _very_final_ output to mangle the session identifier to any (local) url;
in
> case this _very_final_ output is compressed ir can't find any link and
> can't merge the session identifier.
>
> I personally believe it's better to have compression be done at the web
> server (refer to http://httpd.apache.org/docs-2.0/mod/mod_deflate.html).
> It's more general then, after all...
>
>
> --
> >O Ernest E. Vogelsinger
> (\) ICQ #13394035
> ^ http://www.vogelsinger.at/
>
>
>
> --
> 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