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

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -