Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest sNews - sNews 1.7 - with its own forums - for discussion and user mods.

Author Topic: [MOD] Output compression (sNews All Versions)  (Read 6335 times)

iatbm

  • Sr. Member
  • ****
  • Karma: 0
  • Posts: 251
    • Public domain photos
[MOD] Output compression (sNews All Versions)
« on: September 11, 2006, 12:22:56 am »

include('snews.php');
ob_start("ob_gzhandler");
?>

If you want to :D

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4867
  • I'm a self-made man and worships my creator.
    • p-ahlqvist.com
[MOD] Output compression (sNews All Versions)
« Reply #1 on: September 11, 2006, 07:41:20 am »

Hey, iatbm... Would you care to explain what this is, does, means to the regular user/newbie ??

Patric.
Logged
"It's only dead fish that goes with the flow... "
Updated

gomisan

  • Full Member
  • ***
  • Karma: 0
  • Posts: 194
    • http://fish-cam.net/
[MOD] Output compression (sNews All Versions)
« Reply #2 on: September 11, 2006, 10:19:44 am »

hehe, and others ;)
Logged
Check out my sNews powered Tropical Fishtank site, live Fish-Cam !!

philmoz

  • High flyer
  • ULTIMATE member
  • ******
  • Karma: 161
  • Posts: 1988
    • fiddle 'n fly
[MOD] Output compression (sNews All Versions)
« Reply #3 on: September 11, 2006, 10:55:04 am »

geez people, anyone would think you'd not heard of Google  :D
.. or php.net  :D :D

http://au.php.net/ob_gzhandler
Logged
Of all the things I have lost, it is my mind that I miss the most.

PowerNight

  • Newbie
  • *
  • Karma: 0
  • Posts: 3
[MOD] Output compression (sNews All Versions)
« Reply #4 on: September 11, 2006, 10:58:59 am »

Yes I can explain. We talked about it here: http://www.internetmojster.com/viewtopic.php?id=29

and I asked iatbm to post this idea on snews 1.5 forum.

So the idea is to add "ob_start("ob_gzhandler");" to the start of index.php to enable gzip compression for webpages. Your pages will load up to 10 times faster, you will save bandwidth, but it will put extra stress on the server cpu. Test it, it works great on my page :)

I am not a programmer, so please ask google about "ob_gzhandler".

The top of index.php should look like this:

include('snews.php');
ob_start("ob_gzhandler");
?>
Logged

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4867
  • I'm a self-made man and worships my creator.
    • p-ahlqvist.com
[MOD] Output compression (sNews All Versions)
« Reply #5 on: September 11, 2006, 11:11:11 am »

Ah, ok... first I will read the link provided by Phil-san. Power, thanks for the input, and welcome ;)... Stay on and enjoy. Will read that forum debate...

Now, what do we think about this: "but it will put extra stress on the server cpu." ? Safe, secure, too much load on server ? What ?
Logged
"It's only dead fish that goes with the flow... "
Updated

philmoz

  • High flyer
  • ULTIMATE member
  • ******
  • Karma: 161
  • Posts: 1988
    • fiddle 'n fly
[MOD] Output compression (sNews All Versions)
« Reply #6 on: September 11, 2006, 11:17:02 am »

Suggest leaving it to the sNews user as to whether they want to use this....

That is... a  mini-MOD  ;)
Logged
Of all the things I have lost, it is my mind that I miss the most.

iatbm

  • Sr. Member
  • ****
  • Karma: 0
  • Posts: 251
    • Public domain photos
[MOD] Output compression (sNews All Versions)
« Reply #7 on: September 11, 2006, 11:41:39 am »

Quote from: Patric
Ah, ok... first I will read the link provided by Phil-san. Power, thanks for the input, and welcome ;)... Stay on and enjoy. Will read that forum debate...

Now, what do we think about this: "but it will put extra stress on the server cpu." ? Safe, secure, too much load on server ? What ?
Since snews is not server intensive I think that gzip output will not do much harm. It is sure faster. As for security that is server side and since a lot of cms and forum software have this option I think it is secure.

PowerNight

  • Newbie
  • *
  • Karma: 0
  • Posts: 3
[MOD] Output compression (sNews All Versions)
« Reply #8 on: September 11, 2006, 11:45:54 am »

Hey Patric, thanx!

The pages have to be compressed by server first and then sent to browser. If you have a highly visited production site this might be an issue. It worked well (and sitll does) on 20.000+ page generations per day for my previous site. For greater load I don't know.
Logged

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4867
  • I'm a self-made man and worships my creator.
    • p-ahlqvist.com
[MOD] Output compression (sNews All Versions)
« Reply #9 on: September 11, 2006, 12:34:53 pm »

Sounds great. I have also noticed a faster load. And that is nice, nice, nice ;)... So thanks Iatbm and Phil for posting this... I'm sure using it ;) (Til the bloody supplier tells me not too ;)...)
Logged
"It's only dead fish that goes with the flow... "
Updated

Smoothie

  • Newbie
  • *
  • Karma: 0
  • Posts: 18
    • http://rob3rt.net
[MOD] Output compression (sNews All Versions)
« Reply #10 on: October 08, 2006, 11:27:55 pm »

One of the best 'mods' posted here, thanks very much.  My site's loading noticeably faster, especially if I show a lot of posts on the main page.

Great tip! :)

sevir

  • Newbie
  • *
  • Karma: 0
  • Posts: 21
    • http://www.sevir.org
[MOD] Output compression (sNews All Versions)
« Reply #11 on: October 17, 2006, 12:25:30 am »

You only will have problems using old browsers such as Netscape 4, IE 4 and older (win 98 and win 95), lynx (this is not old browser, only text browser) but doesn't support GZIP compression.

You can get the same ob_start("ob_gzhandler"); using ini_set('zlib.output_compression', '1');

Anyway, only compress the text output, not graphics and other multimedia embedded objects, if you have not so much text, for compatibility is better not use GZIP compression.
Logged

ognennyjstorm

  • Guest
[MOD] Output compression (sNews All Versions)
« Reply #12 on: April 27, 2007, 05:13:42 am »

Quote
session_start() will register internal output handler for URL rewriting when trans-sid is enabled. If a user uses ob_gzhandler or like with ob_start(), the order of output handler is important for proper output. For example, user must register ob_gzhandler before session start.

Note: Use of zlib.output_compression is recommended rather than ob_gzhandler()
PHP: session_start - Manual
Logged