PHP compression using gzip

Published by

Posted on January 10, 2010

The best way to compress PHP files is to use

auto_prepend_file

Add the filling code to a file called gzip.php


Then update your php.ini files as follows

auto_prepend_file= /path/to/gzip.php

you can also use a htaccess file if your server permits

php_value auto_prepend_file gzip.php

Testing the compression
or
curl -I -H ‘Accept-Encoding: gzip,deflate’ http://www.example.com
More detailed information on compressing files