Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

I have this in my .htaccess:

<IfModule mod_deflate.c>
	<FilesMatch "\.(js|css|php)$">
		SetOutputFilter DEFLATE

Testing files on my site, it seems that *.js and *.css files are being compressed fine. However, my PHP files are not. These are all direct PHP files, not rewritten in any way or using query parameters - like

Why would this not be working? I'm on shared hosting so can't change the server myself, but is there something specific I can ask my host to change? (Also, I know about using gzip in PHP, I'd prefer a simpler site-wide solution)

share|improve this question
up vote 2 down vote accepted

Compression can be enabled php site wide with this entry in "php.ini":

zlib.output_compression = On

or in .htaccess:

php_flag zlib.output_compression on

This site has a good writeup:


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.