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)

link|improve this question

feedback

1 Answer

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

link|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
feedback

Your Answer

 
or
required, but never shown

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