Is (function_exists('ob_gzhandler') && ini_get('zlib.output_compression'))
enough ?
I want to check if the host is serving compressed pages within one of the pages :)
Double click on the file and select headers. Under 'Response headers' you are looking for the 'Connection-Encoding' field, it will say gzip if it is enabled. NOTE: By default, Deflate is enabled on all of our servers.
You can tell using Developer Tools (F12). Go to the Network tab, select the file you want to examine and then look at the Headers tab on the right. If you are gzipped, then you will see that in the Content-Encoding.
If you just want to test whether or not the file is compressed use gzip --list (redirect errors if you want) and check $? The gzip -t command only returns an exit code to the shell saying whether the file passed the integrity test or not.
For PHP, they'll do fine.
However, if your referring to compression of pages back to clients, you'll also need to check it's enabled in apache (assuming your using apache you'll need the mod_gzip.c OR mod_deflate.c modules).
For instance:
# httpd -l
(apache 2)
Ive also seen mention of needing to implement .htaccess overrides in the past:
#compress all text & html:
AddOutputFilterByType DEFLATE text/html text/plain text/xml
# Or, compress certain file types by extension:
<Files *.html>
SetOutputFilter DEFLATE
</Files>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With