vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   [RELEASE] GZip Compression for vB 1.x (https://vborg.vbsupport.ru/showthread.php?t=7626)

Kier 02-01-2001 11:37 PM

I was playing around with this for a site I'm building, and it occured to me that it would work fine for vB 1.x too, so here you go.

Open your admin/config.php and paste the following code at the end of the file, before the ?> tag.

PHP Code:

<?php

// original bits of config.php go here

$gziplevel 1;

function 
compress_output($output) { 
    global 
$gziplevel;
    return 
gzencode($output,$gziplevel);
    }
    
if (
strstr($HTTP_SERVER_VARS['HTTP_ACCEPT_ENCODING'], 'gzip') && ($gziplevel != 0)) {
    
ob_start("compress_output");
    
header("Content-Encoding: gzip"); 
    } 
?>

This code is adapted from the reference script at zend.com, but with the addition of the ability to set the zip compression level. You can alter the line $gziplevel = 1; to use any number between 0-9 (0 is no compression), but i've found that for my site, a level of 1-3 gives the best balance of speed against CPU loading.

Once you have installed the code snippet, you can test that it's working by a) trying to access your forums b) inputting your URL here (you need to specify the .php file, rather than just the directory) http://leknor.com/code/gziped.php

Of course, you will need to have PHP built with zlib support for this to work. Find out by running a phpinfo() script...

02-02-2001 02:08 PM

If you have PHP 4.04pl1, and you want to just compress ALL php on your site, edit your php.ini file to read this:
output_handler = ob_gzhandler

Have to have PHP 4.04pl1, and compile it to use zlib...

Chris

02-02-2001 04:44 PM

Dosn't work for me, I just get a blank screen.

The Site is on Datablocks.net

If I set it to 1 it works

2 or above gives me a blank screen :(

02-02-2001 04:55 PM

wow! even with it set to 1, the difference was noticed

02-02-2001 07:34 PM

For me it doesn't work with 1 either... :(

02-02-2001 07:37 PM

Quote:

Originally posted by -saturn-
For me it doesn't work with 1 either... :(
You're server must have php4 and zlib :D

02-02-2001 08:13 PM

I'm hosted at www.nomontlyfees.com

I know they have php4, but how can I find if they have zlib?

02-02-2001 08:17 PM

1 Attachment(s)
Easy! Go to yourdomain.com/forum/admin/index.php?action=phpinfo

You should find something like this:

02-02-2001 08:22 PM

I'm sorry to say but I didn't find it...

02-08-2001 11:05 AM

Where can we get zlib?


All times are GMT. The time now is 10:51 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01794 seconds
  • Memory Usage 1,733KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete