Reputation: 217
My Apache server admin claims that the server has deflate/gzip compression enabled.
But when I use some standard code for introducing deflate/gzip compression in my .htaccess file, it seems there is no compression in files.
I used the below lines in .htaccess
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css
<FilesMatch "\\.(js|css|html|htm|php|xml)$">
SetOutputFilter DEFLATE
</FilesMatch>
I am in doubt if the server really has enabled deflate/gzip compression. When I call phpinfo()
it shows me the following rows related to deflate/gzip:
Stream Filter support zlib.inflate, zlib.deflate
HTTP_ACCEPT_ENCODING gzip, deflate
_SERVER["HTTP_ACCEPT_ENCODING"] gzip, deflate
_ENV["HTTP_ACCEPT_ENCODING"] gzip, deflate
Do these lines show the server supports deflate/gzip compression or not?
And if not how should I understand?
Upvotes: 1
Views: 11937
Reputation: 339
After quite some search, it is possible to enable compression for PHP scripts by default by setting the PHP value zlib.compression_output = On
. This way, PHP scripts behave always like if you would put ob_start("ob_gzhandler")
manually.
For Apache it looks like you can only set it with SetOutputFilter
.
Upvotes: 1
Reputation: 1439
`HTTP_ACCEPT_ENCODING gzip, deflate '`.
This line tells it all. It is configured.
Upvotes: 0