我在Ubuntu(11.04和12.04)上使用apache2时遇到了问题,即所有cgi输出都被缓冲直到脚本终止。如果我在Centos/rhel 6.2 apache2上运行相同的脚本,则可以正常运行。
#!/usr/bin/perl
$|=1;
print "Content-type: text/html\r\n\r\n";
print "hi..";
sleep 1;
print "hi..";
sleep 1;
print "hi..";
sleep 1;
我已经确认mod_deflate被禁用。
而且,这不仅仅是一个perl的问题,在Ubuntu和centos/rhel上编写的相同的bash cgi脚本行为也是一样的。