Perlではこんな感じで書いていたのですが、
PHPでgzip圧縮して転送するにはどうすればよいのでしょうか?

$|=1;
if($ENV{'HTTP_ACCEPT_ENCODING'}=~/gzip/ ){
print "Content-type: text/html\n";
print "Content-encoding: gzip\n\n";
open(STDOUT,"| /bin/gzip -1 -c");
}else{
print "Content-type: text/html\n\n";
}