FutureQuest, Inc. FutureQuest, Inc. FutureQuest, Inc.

FutureQuest, Inc.
Go Back   FutureQuest Community > FutureQuest Site Owners (All may read - Only Site Owners May Respond) > Questions & Suggestions
User Name
Password  Lost PW

Reply
 
Thread Tools Search this Thread Display Modes
Old 07-20-2002, 12:38 PM   Postid: 71137
Benj
Registered User

Forum Notability:
10 pts: User-friendly
[Post Feedback]
 
Join Date: Jun 1999
Posts: 391
Gzip compression on regular php pages ?

Hi,
I know gzip works on vbulletin, and I was wandering if I could use the same gzip level compression on all my php pages ?

If yes, how ?

Thanks,
Benj
Benj is offline   Reply With Quote
Old 07-20-2002, 04:26 PM   Postid: 71142
pier
Registered User
 
pier's Avatar

Forum Notability:
0 pts:
[Post Feedback]
 
Join Date: Apr 1999
Location: The Netherlands
Posts: 221
Add the following lines to the start your page(s), so preferably w/ an include:
Code:
if (headers_sent() != TRUE) { 
$gz_possible = isset($HTTP_SERVER_VARS["HTTP_ACCEPT_ENCODING"])
&& eregi("gzip, deflate", $HTTP_SERVER_VARS["HTTP_ACCEPT_ENCODING"]); 
if ($gz_possible) ob_start("ob_gzhandler"); 
}
[shameless plug]
Or use jpcache, www.jpcache.com. I advise you to use the 1.1.1-release.
[/shameless plug]

Pier
[ Time to update CVS ]
pier is offline   Reply With Quote
Old 07-21-2002, 04:49 PM   Postid: 71187
Benj
Registered User

Forum Notability:
10 pts: User-friendly
[Post Feedback]
 
Join Date: Jun 1999
Posts: 391
Ok, thanks.
Do you know a web site where I can test to confirm if the page is compressed ?

Also, How do I choose and set the compression level ? I don't want to compress to much, on the 9 levels I just want to set to 1 like on Vbulletin.

Thansk,
Benj
Benj is offline   Reply With Quote
Old 08-11-2002, 09:48 PM   Postid: 72209
Terence
Visitor

Forum Notability:
0 pts:
[Post Feedback]
 
Join Date: Jul 1999
Posts: 101
Quote:
Do you know a web site where I can test to confirm if the page is compressed?
A late reply, but here you go:
http://leknor.com/code/gziped.php

Question:

Is the code given above needed?
Code:
if (headers_sent() != TRUE) { 
$gz_possible = isset($HTTP_SERVER_VARS["HTTP_ACCEPT_ENCODING"])
&& eregi("gzip, deflate", $HTTP_SERVER_VARS["HTTP_ACCEPT_ENCODING"]); 
if ($gz_possible) ob_start("ob_gzhandler"); 
}
According to this page:
http://www.php.net/manual/en/function.ob-gzhandler.php
just "ob_start("ob_gzhandler");" is enough.

Quote:
Before ob_gzhandler() actually sends compressed data, it determines what type of content encoding the browser will accept ("gzip", "deflate" or none at all) and will return it's output accordingly. All browsers are supported since it's up to the browser to send the correct header saying that it accepts compressed web pages.
Also, with the current version of PHP, is it still advisable to use the following class instead of ob_gzhandler?

http://leknor.com/code/php/view/clas...encode.php.txt

This is what the author said about PHP 4.0.5:
Quote:
// News: I had once said that when PHP4.0.5 comes out I will reccomend the built in
// ob_gzhandler over my code unless you are generating flash or images on the fly.
//
// I was wrong. PHP4.0.5 is out and ob_gzhandler doesn't work for me.

Last edited by Terence : 08-11-2002 at 10:11 PM.
Terence is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 visitors)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -4. The time now is 03:31 AM.


Running on vBulletin®
Copyright © 2000 - 2013, Jelsoft Enterprises Ltd.
Hosted & Administrated by FutureQuest, Inc.
Images & content copyright © 1998-2013 FutureQuest, Inc.
FutureQuest, Inc.