Antwort: Re: [Mod_gzip] SEND_AS_IS:HAS_CE message
Stephen Pierzchala
mod_gzip@lists.over.net
Mon, 05 May 2003 13:21:45 -0700
Ok, I think that I finally tracked this down. Here is my modded mod_gzip
config:
mod_gzip_item_include file ^.*\.php.*$
mod_gzip_item_include mime ^text/.*$
mod_gzip_item_include mime ^application/postscript$
mod_gzip_item_include mime ^application/ms.*$
mod_gzip_item_include mime ^application/vnd.*$
mod_gzip_item_exclude mime ^application/x-javascript$
mod_gzip_item_exclude mime ^image/.*$
Note the manner which I specified the PHP files; some of these files
will have information after the file extension and this appears to
resolve the issues with all PHP files.
Give this a shot and let me know how it works.
smp
Stephen Pierzchala wrote:
> Jack:
>
> Guess I wasn't clear enough.
>
> /phpMyAdmin/main.php?lang=zh-tw&convcharset=iso-8859-1&server=1
> Method 1: 3967 Bytes
> Method 2: 3097 Bytes
>
> If you disable Output Buffering AND zlib_compression, how large are
> these files?
>
> The point I was trying to make was that PHP is compressing these files
> BEFORE they are processed by mod_gzip. When mod_gzip sees that they have
> already been compressed once -- using the native PHP compression -- it
> does not attempt to compress the output a second time.
>
> In fact, if mod_gzip attempted to compress the output after it had
> already been compressed the result would be a larger file, as
> compressing compressed files is a big no-no.
>
> ---
>
> A side note: If you want all text output to be processed by mod_gzip,
> you need one simple line in the mod_gzip config:
>
> mod_gzip_item_include mime ^text/.*$
>
> That will get rid of several lines in your mod_gzip config, and cover
> all files that use "text" in their MIME type.
>
> smp
>
>
> Jack Wang wrote:
>
>> Hi Michael and Stephen,
>>
>> Thanks for your reply.
>>
>>
>>
>>> Hi all:
>>>
>>> PHP does have Content Compression built into it. I have an entire paper
>>> on PHP compression at http://www.webcompression.org/php-compress.html.
>>>
>>
>>
>> Thanks. I have read it. Very good.
>>
>>
>>> Three lines in the php.ini file that you need to be concerned about:
>>>
>>> Method 1:
>>>
>>> output_buffering = On
>>> output_handler = ob_gzhandler
>>> zlib.output_compression = Off
>>
>>
>>
>> Here is the result status by method 1;
>>
>> A) GET /liwen/index.htm HTTP/1.1" 200 808 mod_gzip: OK In:572 -<
>> Out:380 =
>> 34 pct.
>>
>> B) GET /index.php?file=company/contact.html HTTP/1.1" 200 17993 mod_gzip:
>> SEND_AS_IS:HAS_CE In:0 -< Out:0 = 0 pct.
>>
>> C) GET /liwen/php/mail.php HTTP/1.1" 200 818 mod_gzip: SEND_AS_IS:HAS_CE
>> In:0 -< Out:0 = 0 pct.
>>
>> D) GET /phpMyAdmin/main.php?lang=zh-tw&convcharset=iso-8859-1&server=1
>> HTTP/1.1"
>> 200 3967 mod_gzip: SEND_AS_IS:HAS_CE In:0 -< Out:0 = 0 pct.
>>
>>
>>
>>> Method 2:
>>>
>>> output_buffering = Off
>>> output_handler =
>>> zlib.output_compression = On
>>
>>
>>
>> Here is the result staus by method 2;
>>
>> A) GET /liwen/index.htm HTTP/1.1" 200 - mod_gzip: SEND_AS_IS:NO_200
>> In:0 -< Out:0 = 0 pct.
>>
>> B) GET /index.php?file=company/contact.html HTTP/1.1" 200 18263
>> mod_gzip:
>> SEND_AS_IS:HAS_CE In:0 -< Out:0 = 0 pct.
>>
>> C) GET /liwen/php/mail.php HTTP/1.1" 200 818 mod_gzip: SEND_AS_IS:HAS_CE
>> In:0 -< Out:0 = 0 pct.
>>
>> D) GET /phpMyAdmin/main.php?lang=zh-tw&convcharset=iso-8859-1&server=1
>> HTTP/1.1"
>> 200 4079 mod_gzip: SEND_AS_IS:HAS_CE In:0 -< Out:0 = 0 pct.
>>
>> Transparently, Gzip didn't compress PHP code by Method 1 and 2. BTW,
>> Gzip
>> didn't compress HTM by Method 2 (Method 2A).
>>
>> Here is my part of mod_gzip.conf.
>>
>> mod_gzip_item_include file \.html$
>> mod_gzip_item_include file \.htm$
>> mod_gzip_item_include file \.php$
>> mod_gzip_item_include file \.php3$
>> mod_gzip_item_include file \.txt$
>> mod_gzip_item_include file \.pdf$
>> mod_gzip_item_include file [^.]*$
>> mod_gzip_item_include file \.js$
>> mod_gzip_item_include file \.css$
>> mod_gzip_item_include file \.pl$
>> mod_gzip_item_include handler ^cgi-script$
>> mod_gzip_item_include handler ^perl-script$
>> mod_gzip_item_include mime ^text/html$
>> mod_gzip_item_include mime ^text/plain$
>> mod_gzip_item_include mime ^application/pdf$
>> mod_gzip_item_include mime ^httpd/unix-directory$
>> mod_gzip_item_include mime ^application/postscript$
>> mod_gzip_item_include mime ^application/ms.*$
>> mod_gzip_item_include mime ^application/vnd.$
>> mod_gzip_item_include mime ^application/x-httpd-php$
>> mod_gzip_item_exclude mime ^application/x-javascript$
>> mod_gzip_item_exclude mime ^image/.*$
>> mod_gzip_dechunk Yes
>>
>>
>> Might my configuration be wrong ?! Any comment ? Thanks in advance.
>>
>>
>>> In your case, setting "output_buffering = Off" will turn off the PHP
>>> compression.
>>>
>>> I handle all compression through mod_deflate/mod_gzip, but there is
>>> NOTHING wrong with PHP handling compression for PHP files. It just means
>>> that mod_deflate/mod_gzip doesn't NEED to compress the data.
>>>
>>> Just my two cents worth.
>>>
>>> smp
>>>
>>> Michael.Schroepl@telekurs.de wrote:
>>>
>>>> Hi Jack,
>>>>
>>>>
>>>>
>>>>
>>>>> output_handler = ob_gzhandler
>>>>
>>>>
>>>>
>>>> this one is known to provide gzip compression for PHP
>>>> scripts - but don't ask me how to configure or even
>>>> disable it.
>>>> As Kevin pointed out, you may want to comment this out.
>>>>
>>>>
>>>>
>>>>> PS: I have enabled Zend Opertmizer.
>>>>
>>>>
>>>>
>>>> Heureka.
>>>>
>>>> Please read
>>>> http://www.zend.com/zend/art/buffering.php
>>>> where Zend documents their procedure how to serve PHP
>>>> output in compressed form. (Unfortunately, they don't
>>>> use link targets inside their documents ...)
>>>>
>>>> You don't have any problem at all, except for not reading
>>>> the documentation of the suite of software that you are
>>>> using (which includes
>>>>
>>
>> http://www.schroepl.net/projekte/mod_gzip/status.htm#SEND_AS_IS:HAS_CE
>>
>>>> as well), and thus wondering what their diagnostic output
>>>> means.
>>>> After all, who cares which of your modules actually does
>>>> the compression, as long as any one does it?
>>>>
>>>> Regards, Michael
>>>>
>>>>
>>>>
>>>> P.S.: It took me about 30 seconds to ask Google for
>>>>
>>>> "Zend gzip"; the above link is the _first_ hit.
>>>>
>>>>
>>>> _______________________________________________
>>>> mod_gzip mailing list
>>>> mod_gzip@lists.over.net
>>>> http://lists.over.net/mailman/listinfo/mod_gzip
>>>>
>>>>
>>>>
>>>
>>> --
>>>
>>> ****
>>>
>>> Stephen Pierzchala
>>> stephen@pierzchala.com
>>> http://www.performanceguru.com/
>>>
>>> _______________________________________________
>>> mod_gzip mailing list
>>> mod_gzip@lists.over.net
>>> http://lists.over.net/mailman/listinfo/mod_gzip
>>>
>>
>>
>> _______________________________________________
>> mod_gzip mailing list
>> mod_gzip@lists.over.net
>> http://lists.over.net/mailman/listinfo/mod_gzip
>>
>>
>>
>
--
****
Stephen Pierzchala
stephen@pierzchala.com
http://www.performanceguru.com/