I've got the mod_deflate up and running. I can throw in a something.txt file in my apache server and use curl to check it out.
curl --compressed -I /somefile.txt gives me back the following which is good and compressed:
Vary: Accept-Encoding Content-Encoding: gzip
But if i use /some.php i get back:
Accept-Ranges: bytes X-Powered-By: PHP/5.4.4-14+deb7u5
But no Content-Encoding: gzip, the .htaccess i used with multiple options:
AddOutputFilterByType DEFLATE application/json
I also checked if the zlib compression was turned off in the php.ini and also tried to set the output buffer to off. But no matter what i try i never get the php output to be compresse by apache. The overhead from apache to zip it is less than when i use php zlib.
I see enough posts like Apache output compression working for CSS/JS but not PHP but that enables compression from php. I want apache to handle it.
I must be missing something silly here.
UPDATE: I resolved all issues, also because of the answers given. In the end it still didn't work 100%. This was due to the wrong package installed. apache2filter was used which send me on the wrong path.