Re: note 8553 added to gzcompress
| From: | J. M. Castagnetto | Date: | Mon, 18 Sep 2000 11:35:02 +0000 |
| Subject: | Re: note 8553 added to gzcompress | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-5158@lists.php.net to get a copy of this message | ||
Can someone w/ a PHP compiled w/ zlib support confirm
this? (can't get to CVS today server seems dead).
--- wrote:
> As a precaution, the gzcompress() and gzuncompress()
> functions do not actually use gzip style compression
> -- rather, they use compress or deflate.
>
> This will greatly affect compression of output from
> PHP scripts. Assuming that you want to optionally
> compress data from your PHP script to the browser
> (if they support it), then you must not use this
> function.
>
> if (browser_supports_gzip)
> {
> ob_start();
> }
>
> ... you output stuff here ...
>
> if (browser_supports_gzip)
> {
> Header("Content-Encoding: gzip");
> // THIS DOES NOT WORK
> echo gzcompress(ob_get_contents());
> ob_end_clean();
> }
>
> If gzcompress gets changed in the future (4.0.3?)
> then outputting compressed output from PHP scripts
> will be much easier. Until then, you must replace
> the single line above with several others --
> tempnam() to find a temporary file, gzopen() it,
> write the contents of the buffer to the compressed
> file, close the file, open the file as binary, write
> the output to the browser, close the file, delete
> the temporary file.
>
> I sincerely hope that either the documentation is
> changed to reflect that gzip style compression is
> not used, or maybe gzcompress()'s code gets changed
> in PHP.
>
> http://www.php.net/manual/function.gzcompress.php
>
>
> --
> PHP Notes Mailing List (http://www.php.net/)
> To unsubscribe, e-mail:
> php-notes-unsubscribe@lists.php.net
> For additional commands, e-mail:
> php-notes-help@lists.php.net
> To contact the list administrators, e-mail:
> php-list-admin@lists.php.net
>
=====
--- Jesus M. Castagnetto (jcastagnetto@yahoo.com)
__________________________________________________
Do You Yahoo!?
Yahoo! Mail - Free email you can access from anywhere!
http://mail.yahoo.com/