Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We used this PHP code to disable gzip compression for specific scripts

@apache_setenv('no-gzip', 1);

But our admin migrated to FastCGI and this does not work anymore. How to do it?


share|improve this question

Off the top of my head I don't recall the specific rules to apply but it's likely that your answer is using a rewrite rule in htaccess to set the environment for Apache whenever certain scripts are accessed that you don't want gzip compression used on.

I believe it's something like:

<Location />
SetOutputFilter DEFLATE
SetEnvIfNoCase Request_URI ^/your-non-gizp.php$ no-gzip

The only times this wouldn't be the best choice is if you don't know which scripts ahead of time that need to be set to not have their output compressed or if you need to set it on/off based on dynamic logic within the script.

There's another way to do it which would keep FastCGI from caching the output but that would defeat the purpose. The htaccess method is probably best.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.