PDA

View Full Version : [RELEASE] GZip Compression for vB 1.x


Kier
02 Feb 2001, 00:37
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.



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------


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 Feb 2001, 15:08
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 Feb 2001, 17:44
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 Feb 2001, 17:55
wow! even with it set to 1, the difference was noticed

02 Feb 2001, 20:34
For me it doesn't work with 1 either... :(

02 Feb 2001, 20:37
Originally posted by -saturn-
For me it doesn't work with 1 either... :(

You're server must have php4 and zlib :D

02 Feb 2001, 21:13
I'm hosted at www.nomontlyfees.com

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

02 Feb 2001, 21:17
Easy! Go to yourdomain.com/forum/admin/index.php?action=phpinfo

You should find something like this:

02 Feb 2001, 21:22
I'm sorry to say but I didn't find it...

08 Feb 2001, 12:05
Where can we get zlib?

08 Feb 2001, 12:26
ftp://ftp.freesoftware.com/pub/infozip/zlib/zlib.tar.gz

if you prefer RPM:
ftp://ftp.rpmfind.net/linux/ASPLinux/i386/RPMS.09182000/zlib-1.1.3-6.i386.rpm

08 Feb 2001, 12:41
thanks

08 Feb 2001, 20:20
Just a little hint for you all...

Don't do this UNTILL you have vB installed and Working.

Here's my Directory Structure

# 127.0.0.1
|-- www
|----root
|------vbulletin1
|------vbulletin2
|------vbulletin3
|------vbulletin4

Thats on my local machine. I messed up installs 2 & 3 so i deleted all the files, unzipped and copied over again.

Ran the install and got GOBBLE! Then I realised. Just a reminder :p

12 Feb 2001, 14:31
Careful, guys. PHP4.0.4pl1 has a memory leak in it's zlib implementation. A lot of heavy-load website have crashed already because of it.

You might wanna wait til it's fixed.

12 Feb 2001, 14:44
For what it's worth, I have been watching this carefully and have had no problems with PHP Version 4.0.1pl2
running on FreeBSD 4.2.

The method I'm using is placing ob_start(ob_gzhandler); at the top of all my files.