Forum Moderators: coopster

Message Too Old, No Replies

Gzip doesn't work. Can I find out why?

         

jake66

2:46 am on Mar 15, 2008 (gmt 0)

10+ Year Member



I have a relatively small script (2 pages) that rewrite my dynamic URLs into friendly URLs.

When I installed this, the instructions said very plainly "Gzip does not work, disable it" with no explanation as to why.

The code seems very clean and I'd like to be able to troubleshoot this myself and somehow enable it.

What should I be looking for? What conflicts with gzip?

vincevincevince

2:49 am on Mar 15, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm guessing your script is grabbing the page output after gzip has already compressed it; and hence is unable to edit the URLs. Gzip enabled through Apache should be safe in that case; but not Gzip implemented through PHP commands.

jake66

2:55 am on Mar 15, 2008 (gmt 0)

10+ Year Member



Is there any way to find out if I have gzip enabled for Apache?
If not, how would I enable it?

A user on php.net posted:

There are very few circumstances in which this should not be used.

In what circumstances should gzip be avoided?

vincevincevince

3:11 am on Mar 15, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Avoid it where you serve lots of very small pages. Enable it using either .htaccess at the site level; or httpd.conf at the server level.

jake66

3:18 am on Mar 15, 2008 (gmt 0)

10+ Year Member



I tried adding this to my .htaccess:
php_flag zlib.output_compression On
php_value zlib.output_compression_level 5

beneath:

RewriteEngine on
RewriteBase /

and got a 500 error. Which I assume is because I have phpsuxec.

Am I able to add a php.ini for this?

jake66

3:28 am on Mar 15, 2008 (gmt 0)

10+ Year Member



Got it!

output_buffering = On
output_handler = ob_gzhandler
zlib.output_compression = Off

I also found:

output_buffering = Off
output_handler =
zlib.output_compression = On

..is there a difference?

I also read around WebmasterWorld that gzipping your error pages can be bad. Mine are now gzipped. Does this matter?

As well, I have root access to my server. Should I add this to the server php.ini, or is it fine leaving a new php.ini inside each of my website accounts?