One way to use gzip compression when requested by the client is by setting
zlib.output_compression = On
in your php.ini.
When you do not have access to the webserver there is also the option to use the above setting in a ".user.ini" file in the root of your website. Search the phpinfo() for the "user_ini.filename" setting just in case the default filename has been set to something else.
This use of ".user.ini" file is supported since PHP 5.3.0.