if you want to send an output to the browser (which accepts gzip), and you haven't set the buffering callback ob_start("ob_gzhandler"), you may use the gzencode() function.
header("Content-Encoding: gzip");
echo gzencode("some output", 9, FORCE_GZIP);