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: How to use this PHP script for gz compression?  (Read 3136 times)

Sven

  • ULTIMATE member
  • ******
  • Karma: 88
  • Posts: 2029
  • Chasing MY bugs!
    • hiseo.fr - rédacteur Web
How to use this PHP script for gz compression?
« on: November 08, 2009, 10:59:47 am »

Howdee pals?
My 1and1 server doesn't allow gz compression so I've found a php script (http://www.julienlecomte.net/blogfiles/gz.phps) which should do the job.
In my index file I've put:
Code: [Select]
include('gz.phps');and at the top my template file:
Code: [Select]
<?php ob_start(); ?>The result is a 500 error (or 400, depends).
I'm just wondering if it comes from an error I made or from the server which doesn't accept it?

Have a nice sunday and, remember, it's haring's season.
« Last Edit: November 08, 2009, 11:03:51 am by Sven »
Logged

Joost

  • Guest
Re: How to use this PHP script for gz compression?
« Reply #1 on: November 08, 2009, 12:07:40 pm »

The script responses to $_GET["uri"], which basically means requests like:
index.php?uri=Philippe.
To make it work for sNews, it need to be $_GET["category"], as requests are (re)written to
http://www.hiseo.fr/?category=creation-web/
However, this doesn't mean it will work, as zlib is not enabled by default, the script might need this and it might need tweaking.

And be aware, the script might be counter effective: A gzipped page (which is sort of caching) needs quite a few requests, before it pays off, as gzipping comes at a price (resources). Therefore the gzipped file should exist long enough. On the other hand, keeping the file to long, can result in not updated menu_articles or new_comments


Have a nice sunday and, remember, it's haring's season.

Remember it is Sunday, so my favourite haring stal is closed.  :(
I had two harings Friday, though.  :P (3.5 euros each, that's quite expensive)
« Last Edit: November 08, 2009, 12:17:04 pm by Joost »
Logged

Joost

  • Guest
Re: How to use this PHP script for gz compression?
« Reply #2 on: November 08, 2009, 02:37:17 pm »

ps: if you don't want caching, but do want to output compressed pages, you can use

php_value output_handler ob_gzhandler

in .htaccess

The code you probably cannot use ( not allowed by 1and1) is

AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css


Logged

Sven

  • ULTIMATE member
  • ******
  • Karma: 88
  • Posts: 2029
  • Chasing MY bugs!
    • hiseo.fr - rédacteur Web
Re: How to use this PHP script for gz compression?
« Reply #3 on: November 08, 2009, 03:54:39 pm »

Have a nice sunday and, remember, it's haring's season.

Remember it is Sunday, so my favourite haring stal is closed.  :(
I had two harings Friday, though.  :P (3.5 euros each, that's quite expensive)
3.5€ for only 2!!!
I pay this for a kilo.
The fishmerchant cut the fillets and I run home to prepare them: salted, 2 days in the fridge, then,
lay the fillets in terrine with oil, juniper, bay leaves, onion and carot slices, then,
put the terrine in the fridge, and (the most difficult) wait for 2 days more.
Open an Heineken. Enjoy. This is called real life. And I just love it.

What were we talkin about?
Oh yes: compression, .htaccess, PHP and all that geekeries.
Forget it. ;)

Joost

  • Guest
Re: How to use this PHP script for gz compression?
« Reply #4 on: November 08, 2009, 04:53:26 pm »

3.5€ for only 2!!!
I pay this for a kilo.
The fishmerchant cut the fillets and I run home to prepare them: salted, 2 days in the fridge, then,
lay the fillets in terrine with oil, juniper, bay leaves, onion and carot slices, then,
put the terrine in the fridge, and (the most difficult) wait for 2 days more.
Open an Heineken. Enjoy. This is called real life. And I just love it.

Herring, preserved in salt,  (that's what I am talking about) is considered a delicacy and therefore quite expensive (all fish is).
A lot of food products are expensive in Holland: bay leaves and other spices and herbs, you cannot get fresh and cost approximately 80 cents per 10 grams.( I guess the food coloring makes it expensive). Good meat is expensive or not available (I don't mean the protein bombs from chicken and cow factories). Only Heineken and vegetables (is marijuana a vegetable?) are available everywhere, at a good price.


What were we talkin about?
Oh yes: compression, .htaccess, PHP and all that geekeries.
Forget it. ;)
PHP, what's that? Can I eat it?
Logged

Sven

  • ULTIMATE member
  • ******
  • Karma: 88
  • Posts: 2029
  • Chasing MY bugs!
    • hiseo.fr - rédacteur Web
Re: How to use this PHP script for gz compression?
« Reply #5 on: November 09, 2009, 10:03:44 am »

(...) is marijuana a vegetable?
What were we talkin about?
Oh yes: compression, .htaccess, PHP and all that geekeries.
Forget it. ;)
PHP, what's that? Can I eat it?
Yeap if it sends a space cookie. ;D