Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 04-21-2002, 02:58 PM
iAlex's Avatar
iAlex iAlex is offline
 
Join Date: Oct 2001
Location: Trondheim, Norway
Posts: 12
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default gzip compression: howto

Greetings,

I have vbulletin running, of course, with gzip compression enabled. Since my connection is reasonably fast, I hardly notice a significant difference between php pages that are compressed (the forum) and those that aren't (the rest of the site).

But today traffic was soaring and the site was slooow, whereas the forum was ok. What I'm wondering is how can I set all the other php pages to use the compression, I assume it shouldn't be a problem since everything needed is already there, used by the forum. How can I "turn it on" for the rest of the site?

Let me know if you need any specific info.

Any help much appreciated!!!
Reply With Quote
  #2  
Old 04-21-2002, 03:53 PM
whizkid whizkid is offline
 
Join Date: Nov 2001
Posts: 9
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi,

try setting following PHP code at the top of all PHP sites, whom you want to have GZ compression activated:

PHP Code:
ob_start("ob_gzhandler"); 

whizkid
Reply With Quote
  #3  
Old 04-21-2002, 04:10 PM
Scott MacVicar Scott MacVicar is offline
 
Join Date: Oct 2001
Location: Glasgow, Scotland
Posts: 1,199
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The site could have been slow due to the extra cpu time required to compress the content before sending it to the client.

The gzip compression is designed to reduce bandwidth which will reduce loading time for most people, less time to download page = faster loading.

I have noticed that with alot of users on all wanting gzipped pages that the server load jumps up a great deal.
Reply With Quote
  #4  
Old 04-21-2002, 07:16 PM
iAlex's Avatar
iAlex iAlex is offline
 
Join Date: Oct 2001
Location: Trondheim, Norway
Posts: 12
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

whizkid, that's all it takes? Does that mean it uses the same settings (ie. compression level) as I have set for the forum?

And how do I check whether the compression is on or off, whether it's working or not?

Finally, does the code have to be the first line of code in the file, ie. before the html code starts? Or doesn't it matter where it is?

PPN, I am aware of that, but in this case I had in mind the compression. My site is on a large server with a lot more sites so the difference in load should not be spectacular. Moreover, I am quite convinced it was a question of bandwidth this time.
Reply With Quote
  #5  
Old 04-21-2002, 07:55 PM
Scott MacVicar Scott MacVicar is offline
 
Join Date: Oct 2001
Location: Glasgow, Scotland
Posts: 1,199
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

the code would have to be before any information was sent to the browser
Reply With Quote
  #6  
Old 04-21-2002, 08:14 PM
whizkid whizkid is offline
 
Join Date: Nov 2001
Posts: 9
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi,

well it works for me . You could check by loadeing a page without the compression activated and then with the compression activated and see if it makes a difference.
I put my code before any output to the browser happens.


whizkid

Quote:
Originally posted by iAlex
whizkid, that's all it takes? Does that mean it uses the same settings (ie. compression level) as I have set for the forum?

And how do I check whether the compression is on or off, whether it's working or not?

Finally, does the code have to be the first line of code in the file, ie. before the html code starts? Or doesn't it matter where it is?


PPN, I am aware of that, but in this case I had in mind the compression. My site is on a large server with a lot more sites so the difference in load should not be spectacular. Moreover, I am quite convinced it was a question of bandwidth this time.
Reply With Quote
  #7  
Old 04-22-2002, 01:02 PM
wooolF[RM]'s Avatar
wooolF[RM] wooolF[RM] is offline
 
Join Date: Jan 2002
Posts: 524
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

]
Quote:
Originally posted by whizkid
Hi,

try setting following PHP code at the top of all PHP sites, whom you want to have GZ compression activated:

PHP Code:
ob_start("ob_gzhandler"); 

whizkid
erm... sorry for newbie question... do I have to set it in all php pages or in all templates or... ? I'm just lost...
If it's in templates, can I just set it in the header?
Reply With Quote
  #8  
Old 04-22-2002, 02:04 PM
Scott MacVicar Scott MacVicar is offline
 
Join Date: Oct 2001
Location: Glasgow, Scotland
Posts: 1,199
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

as long as you set it in a php file that is called on every page, i have a header.php file which is called on every page on my site, so you could just add it to that and as long as the script includes header.php it will run it.
Reply With Quote
  #9  
Old 04-22-2002, 02:50 PM
iAlex's Avatar
iAlex iAlex is offline
 
Join Date: Oct 2001
Location: Trondheim, Norway
Posts: 12
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It's not working. I copied one of your page that I assume are outside the forum and using the code you posted: http://www.php4-forum.com/php_tutorials/.

I made two versions, one with only the php code and the html and another with <? ob_end_flush() ?> at the very end. None of them work, I can't seem to load them in any of the browsers I've tried with. Have a look:
http://www.juventuz.com/home/gzip/

When I try to load either one, IE gives me a dns error. What do you think the problem is?
Reply With Quote
  #10  
Old 04-23-2002, 06:30 PM
bigmattyh's Avatar
bigmattyh bigmattyh is offline
 
Join Date: Nov 2001
Posts: 141
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

By the way, gzip will NOT compress images -- only text. So if the rest of your site has images galore, that could explain why you aren't seeing an improvement on the rest of your site.
Reply With Quote
Reply


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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:41 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.07065 seconds
  • Memory Usage 2,259KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete