json - gzip compression with gzhandler php for 4kb file -
i wanted implement gzip compression functionality json output php script does, quicker way decided gzip json content via function ob_start("ob_gzhandler");
the original file json content output around 4kb uncompressed, , becomes 0.7kb after compression.
does make sense compress @ such small file size or should not compress @ all, won't make significant difference on speed of download , might bad idea put more strain on vps cpu.
if running apache , have mod_deflate
can add following .htaccess
.
addoutputfilterbytype deflate text/json application/json
for nginx can add following site.conf
file.
gzip on; gzip_disable "msie [1-6]\.(?!.*sv1)"; gzip_vary on; gzip_types text/json application/json;
Comments
Post a Comment