Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have this in my .htaccess:

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

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 http://example.com/folder/page.php.

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

1 Answer 1

up vote 1 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:

[http://www.mybelovedphp.com/2006/11/29/how-to-use-gzip-compression-on-your-php-websites/%5D%5B1%5D

share|improve this answer
    
Thanks for the suggestion, but it didn't work. I'll see if my host can add the line to the php.ini file. –  DisgruntledGoat Dec 21 '09 at 21:34

Your Answer

 
discard

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.