Connecting Tech Pros Worldwide Forums | Help | Site Map

ob_gzhandler won't work with SSI?

DesignGuy
Guest
 
Posts: n/a
#1: Jul 17 '05
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?





Blank
Guest
 
Posts: n/a
#2: Jul 17 '05

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?
DesignGuy
Guest
 
Posts: n/a
#3: Jul 17 '05

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...[color=blue]
> 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?[/color]

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



Blank
Guest
 
Posts: n/a
#4: Jul 17 '05

re: ob_gzhandler won't work with SSI?


DesignGuy wrote:[color=blue]
> There are thousands of HTML files that were created years ago, so[/color]
renaming[color=blue]
> 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?[/color]

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.
DesignGuy
Guest
 
Posts: n/a
#5: Jul 17 '05

re: ob_gzhandler won't work with SSI?



"Blank" <blank@example.net> wrote in message
news:EAVHd.17731$wi2.15508@newssvr11.news.prodigy. com...[color=blue]
> DesignGuy wrote:[color=green]
> > There are thousands of HTML files that were created years ago, so[/color]
> renaming[color=green]
> > and fixing links is not an option. Is there anyway to restrict[/color][/color]
ob_gzhandler[color=blue][color=green]
> > to only compress files in a certain directory? For instance, only[/color][/color]
compress[color=blue][color=green]
> > files in www.domain.com/abc/ and leave everything else alone?[/color]
>
> 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.[/color]

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.





DesignGuy
Guest
 
Posts: n/a
#6: Jul 17 '05

re: ob_gzhandler won't work with SSI?



"DesignGuy" <dontbother@nowhere.com> wrote in message
news:LEhHd.10757$ox3.6607@attbi_s04...[color=blue]
> 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[/color]
in[color=blue]
> the HTML pages using SSI:
> <!--#include virtual="/includes/header.php"-->
>
> the portion of the page that would have been the output from the[/color]
header.php[color=blue]
> script is garbage.
>
> Any ideas?[/color]


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).




Closed Thread