Reputation: 415
I Gzip my pages currently like so:
<?php
ob_start("ob_gzhandler");
//my page content
ob_flush();
?>
However, I read a comment somewhere, earlier on, that this method uses a lot of memory, and I know that my website has been using a lot of memory on my virtual private server, so I thought it would be nice if I knew a way to reduce memory usage.
I tested my site with an online gzip tester which says my websites are sending gzipped pages, so my gzip method works, but the main obviously I'm looking for a less memory intensive option, if any.
I appreciate all suggestions. :) Oh and merry christmas ;P
Upvotes: 3
Views: 302
Reputation: 146380
If it's an option, Apache has a module that's able to perform transparent compression on any file type you configure, including JavaScript, CSS and of course PHP-generated HTML:
http://httpd.apache.org/docs/2.2/en/mod/mod_deflate.html
Upvotes: 2
Reputation: 19380
You can use Apache mod_deflate if you are using Apache v2+ (via .htaccess)
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE application/javascript text/css text/html text/xml
</IfModule>
I don't think you can optimize anything there, just don't set compression level high, because there are minor changes in size but big in CPU usage.
Also compressing images and other similar content is useless because it is already compressed. Compression works best on text.
Upvotes: 2
Reputation: 1087
I apologize for my accent. This perefod from translate.google.com. You use ngix technology. If so look about the module ngx_http_gzip_static_module. They say that it increases the speed of compression. And tell us about your character on your server.
Upvotes: 1
Reputation: 437336
Using the zlib.output_compression
setting in php.ini may produce better results, as the documentation says it is to be preferred over ob_gzhandler
.
Upvotes: 3