1
Catzwolf
Compression Bug Fix
  • 2005/6/1 5:04

  • Catzwolf

  • Home away from home

  • Posts: 1392

  • Since: 2007/9/30


if ( $xoopsConfig['gzip_compression'] == && $xoopsConfig['debug_mode'] == )
    {
        
$phpver phpversion();
        
$useragent = ( isset( $_SERVER["HTTP_USER_AGENT"] ) ) ? $_SERVER["HTTP_USER_AGENT"] : $HTTP_USER_AGENT;

        if ( 
$phpver >= '4.0.4pl1' && ( strstr$useragent'compatible' ) || strstr$useragent'Gecko' ) ) )
        {
            if ( 
extension_loaded'zlib' ) )
                
ob_start'ob_gzhandler' );
        } 
        else if ( 
$phpver '4.0' )
        {
            if ( 
strstr$_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip' ) )
            {
                if ( 
extension_loaded'zlib' ) )
                {
                    
$do_gzip_compress true;
                    
ob_start();
                    
ob_implicit_flush);
                    
header'Content-Encoding: gzip' );
                } 
            } 
        } 
    } 
    else
    {
        
ob_start();
    }


Fix for compression bug in most of version 2 of Xoops.

Enjoy,

ATB

Catz

2
Herko
Re: Compression Bug Fix
  • 2005/6/2 20:29

  • Herko

  • XOOPS is my life!

  • Posts: 4238

  • Since: 2002/2/4 1


thanks

Herko

3
Mithrandir
Re: Compression Bug Fix

I'm putting in some code in XOOPS 2.1 CVS now. I'd be obliged if anyone could test it with gzip compression and see if it works. As far as I can tell, it does, but I don't know enough about the matter to know for sure.

It'll be in CVS Nightly tomorrow (available from xoops.org front page) - if you want to check the code, it will be in the class/theme.php, XTheme's constructor.

4
Catzwolf
Re: Compression Bug Fix
  • 2005/6/2 22:29

  • Catzwolf

  • Home away from home

  • Posts: 1392

  • Since: 2007/9/30


Your Welcome

ATB

Catz

5
Mithrandir
Re: Compression Bug Fix

oh yeah - forgot

Thanks, Catz.

6
Catzwolf
Re: Compression Bug Fix
  • 2005/6/2 22:43

  • Catzwolf

  • Home away from home

  • Posts: 1392

  • Since: 2007/9/30


hehe!

Np Mith

ATB

Catz

7
vampire8
Re: Compression Bug Fix
  • 2005/7/11 7:35

  • vampire8

  • Just popping in

  • Posts: 11

  • Since: 2005/7/5 5


er... where does this code go? I mean, in which file do I insert this to get compression to work again?

Also, shouldn't the compression be done before caching, so that if there's a cache hit, it doesn't need to be compressed again (the compressed content can just be sent out). Will be _much_ more efficient, as the server will be able to handle MUCH more load.

Thanks

Sumit.

8
wizanda
Re: Compression Bug Fix
  • 2007/3/19 15:21

  • wizanda

  • Home away from home

  • Posts: 1588

  • Since: 2004/3/21


Ok this appears to work, yet not as expected (by me), as in before adding this to class/theme.php

I had decided that
.htaccess
php_value output_handler ob_gzhandler
worked better then:
php_flag zlib.output_compression on

Yet as the instructions in php says, if zlib is loaded, so on changing this last night and then visiting my site, there was huge delay after all the work done lately.

So then questioned where, as I had seen bouncing like it before as browsing and realized it was the hack working for gzip of Xoops.
so first removed the htacess ob_gzhandler that was there and this had indeed slowed it.
So then tested does XOOPS now have gzip, yet on a gzip test no ,
yet the site is faster on content, so it looks like this doesn’t compress from the head of the theme, yet the head of the XOOPS content.(there are also references in the file download extensions for gzipping them)

So then as that says if zlib loaded, this I have now added to the htaccess

php_flag zlib.output_compression on

To finish it, so then XOOPS content is gzip (I think) and then files as read, are done via the htaccess.

Sill in testing, yet will see how it handles after a day or so.......

Login

Username:
Password:

Lost Password? Register now!

Who's Online

76 user(s) are online (49 user(s) are browsing Support Forums)


Members: 0


Guests: 76


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits