How to check if my shared hosting provider has mod_gzip installed?
Solution 1
You can check that with either PHP’s apache_get_modules
or phpinfo
.
If you want to compress your output, you might want to try the output buffer handler ob_gzhandler
. It automatically determines what type of content encoding the browser will accept ("gzip", "deflate" or none at all) and will return its output accordingly. Just put ob_start('ob_gzhandler')
at the start of your script file (before anything is put out) and it does the rest.
Or you simply use Apache’s mod_deflate that even can compress static files that are directly passed through to the client.
Solution 2
If you upload a tiny little PHP file to your server containing the following you can see all the output from phpinfo. Lots of interesting details.
<?php
phpinfo();
?>
Searching the page for "Loaded Modules" should show all the modules that are loaded. Look for mod_deflate also as that seems to be more common (comes with Apache 2.0 installs anyway). Performance? gzip might be more compress, deflate might be faster.
Solution 3
After reading the answers above I typed into command line
php -r "phpinfo();" | grep gzip
and it returned
gzip compression => enabled
sweet!
Goran
Updated on June 27, 2022Comments
-
Goran almost 2 years
Is there a way to check if my hosting provider has mod_gzip enabled? It's not mentioned in any info on the web site, nor there is a forum to contact other people about this problem. Thanks.
-
Eric Petroelje almost 15 yearsFYI - best not to leave that file sitting around after you are done with it. Any hacker who might stumble across it will also benefit from knowing all about your system config.
-
Gumbo almost 15 yearsThe
Accept-Encoding
header field is a request header field (see w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.3). It tells what encodings the client accepts and not what encodings the server supports.