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'...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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? |
|
|||
|
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? |
|
|||
|
"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 |
|
|||
|
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. |
|
|||
|
"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. |
|
|||
|
"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). |