I have found a couple of tutorials on how to enable gzip, but nothing seems to be working for me, so my question is how do i enable gzip. I am on a shared Dreamhost hosting server, It is running PHP version 5.2, and Apache, from the php info i have found this line, maybe this could help?
zlib
ZLib Support enabled
Stream Wrapper support compress.zlib://
Stream Filter support zlib.inflate, zlib.deflate
Compiled Version 1.2.3.3
Linked Version 1.2.3.3
Directive Local Value Master Value
zlib.output_compression Off Off
zlib.output_compression_level -1 -1
zlib.output_handler no value no value
I have also found this line
_SERVER["HTTP_ACCEPT_ENCODING"] gzip, deflate
I don't know if that has anything to do with it. But that is my first question, secondly, i have dropbox, hosting a javscript file, and I am wondering is it possible to have that file gzipped, It is not being transfered compressed, so is ther any way to do so?
Have you tried with ob_gzhandler?
<?php
ob_start("ob_gzhandler");
?>
<html>
<body>
<p>This should be a compressed page.</p>
</html>
<body>
Tip: Sometimes is pretty tricky to detect if the web is send compressed or not, i use firefox's firebug plugin, i tested a php file without compression and with compression and compare the size, in my case, the difference was 1mb (non compressed) and 56kb compressed.
Or in your .htaccess
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript
</IfModule>
what about for the stylesheet and the javascripts? i was figuring it would be more of an .htaccess thing. i will try this though.
As far as i can see that is not giving me any results.
all that did was make the page output the sourcecode minus the php. btw, i appreciate the help. thanks for tyring to help me out
Make sure to check the browser supports gzip compression: <?php if (substr_count($_SERVER[‘HTTP_ACCEPT_ENCODING’], ‘gzip’)) {ob_start(“ob_gzhandler”);} ?>
Why not just using the php.ini configuration
zlib.output_compression = 1
?