ob_gzhandler won't work with SSI?

This is a discussion on ob_gzhandler won't work with SSI? within the PHP Language forums, part of the PHP Programming Forums category; I've enabled ob_gzhandler in my php.ini using the line below: output_handler = ob_gzhandler (I believe this means I won'...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-19-2005
DesignGuy
 
Posts: n/a
Default ob_gzhandler won't work with SSI?

I've enabled ob_gzhandler in my php.ini using the line below:
output_handler = ob_gzhandler

(I believe this means I won't have to put the ob_start line at the top of
every page, right?)


Using this does seem to speed up page load. However, when I include files in
the HTML pages using SSI:
<!--#include virtual="/includes/header.php"-->

the portion of the page that would have been the output from the header.php
script is garbage.

Any ideas?




Reply With Quote
  #2 (permalink)  
Old 01-20-2005
Blank
 
Posts: n/a
Default Re: ob_gzhandler won't work with SSI?

You're putting gzipped data into an HTML stream that is sent to the
browser non-gzipped. The browser doesn't know that that part of the
HTML stream is gzipped.

Change the HTML file to a PHP file and then require-in the header.php
file. That should work.

Really, if you want everything to be gzipped to save bandwidth, why are
you still using plain HTML files anyway?
Reply With Quote
  #3 (permalink)  
Old 01-20-2005
DesignGuy
 
Posts: n/a
Default Re: ob_gzhandler won't work with SSI?


"Blank" <blank@example.net> wrote in message
news:s%NHd.21481$iC4.8730@newssvr30.news.prodigy.c om...
> You're putting gzipped data into an HTML stream that is sent to the
> browser non-gzipped. The browser doesn't know that that part of the
> HTML stream is gzipped.
>
> Change the HTML file to a PHP file and then require-in the header.php
> file. That should work.
>
> Really, if you want everything to be gzipped to save bandwidth, why are
> you still using plain HTML files anyway?


There are thousands of HTML files that were created years ago, so renaming
and fixing links is not an option. Is there anyway to restrict ob_gzhandler
to only compress files in a certain directory? For instance, only compress
files in www.domain.com/abc/ and leave everything else alone?

Thank for your help



Reply With Quote
  #4 (permalink)  
Old 01-20-2005
Blank
 
Posts: n/a
Default Re: ob_gzhandler won't work with SSI?

DesignGuy wrote:
> There are thousands of HTML files that were created years ago, so

renaming
> and fixing links is not an option. Is there anyway to restrict ob_gzhandler
> to only compress files in a certain directory? For instance, only compress
> files in www.domain.com/abc/ and leave everything else alone?


Oh, I see. Well, I have no idea about the resticting to a certain
directory.

Maybe you could write a PHP script to change all the HTML files to PHP
files and alter the links within them as well. All it has to do is
rename the files have a ".php" extension and then change the links
within to point to ".php" instead of ".html". Of course you should back
up the existing files first, and test the script on a different set of
data, but it seems like it should be possible.
Reply With Quote
  #5 (permalink)  
Old 01-21-2005
DesignGuy
 
Posts: n/a
Default Re: ob_gzhandler won't work with SSI?


"Blank" <blank@example.net> wrote in message
news:EAVHd.17731$wi2.15508@newssvr11.news.prodigy. com...
> DesignGuy wrote:
> > There are thousands of HTML files that were created years ago, so

> renaming
> > and fixing links is not an option. Is there anyway to restrict

ob_gzhandler
> > to only compress files in a certain directory? For instance, only

compress
> > files in www.domain.com/abc/ and leave everything else alone?

>
> Oh, I see. Well, I have no idea about the resticting to a certain
> directory.
>
> Maybe you could write a PHP script to change all the HTML files to PHP
> files and alter the links within them as well. All it has to do is
> rename the files have a ".php" extension and then change the links
> within to point to ".php" instead of ".html". Of course you should back
> up the existing files first, and test the script on a different set of
> data, but it seems like it should be possible.


Unfortunately, also not on option since the search engines have indexed the
existing site structure thoroughly and with good rankings.

If I figure it out I'll post in this thread.

Thanks again for your help; at least I know why I was getting the garbage
characters.





Reply With Quote
  #6 (permalink)  
Old 01-21-2005
DesignGuy
 
Posts: n/a
Default Re: ob_gzhandler won't work with SSI?


"DesignGuy" <dontbother@nowhere.com> wrote in message
news:LEhHd.10757$ox3.6607@attbi_s04...
> I've enabled ob_gzhandler in my php.ini using the line below:
> output_handler = ob_gzhandler
>
> (I believe this means I won't have to put the ob_start line at the top of
> every page, right?)
>
>
> Using this does seem to speed up page load. However, when I include files

in
> the HTML pages using SSI:
> <!--#include virtual="/includes/header.php"-->
>
> the portion of the page that would have been the output from the

header.php
> script is garbage.
>
> Any ideas?



SOLUTION:

I ended up using zlib.output_compression as it was recommended over
ob_gzhandler. I put the following two lines in an .htaccess file in the
directory I wanted to compress:

php_flag zlib.output_compression On
php_value zlib.output_compression_level -1

It seems to work fine.

BTW, -1 compression level is the system default. It can range from 0-9 with
9 being the highest compression. I did not see much difference between -1
and 9 so I left it at -1 (default).




Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 10:12 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0