Already i shown how to enable GZIP in YII Framework application, To enable GZIP in general PHP Application include the below code at the top of the document you want to gzip:
<?php if( isset( $_SERVER['HTTP_ACCEPT_ENCODING'] ) && substr_count( $_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip' ) ) ob_start( 'ob_gzhandler' ); else ob_start(); ?>