Using Gzip/Deflate with Codeigniter for better performance

Mukesh Yadav picture Mukesh Yadav · Nov 11, 2010 · Viewed 7.1k times · Source

I'm using Codeigniter a PHP framework and apache2.
I have enabled Gzip and deflate mod in apache2 and its showing phpinfo(). When I run Yslow it shows "Grade F on Compress components with gzip".
Even I changed the config.php of Codeigniter
$config['compress_output'] = TRUE;

but there is no effect. Is any thing I'm missing.

Answer

mazgalici picture mazgalici · Nov 19, 2010

you should enable mod_deflate just for CSS, html, js.

Ex:

<ifmodule deflate_module>
    DeflateCompressionLevel 1
    DeflateBufferSize 8096
    DeflateMemLevel 8
    DeflateWindowSize 8

    AddOutputFilterByType DEFLATE text/css
    AddOutputFilterByType DEFLATE text/html
    AddOutputFilterByType DEFLATE text/plain
    AddOutputFilterByType DEFLATE text/xml
</ifmodule>

Because images or videos are already compressed and also they take a lot of time to try to compress. Also there is a compress option on php.ini

Maybe it helps...