How is flush different in php5.3 vs php5.2?

[email protected] (Tim Galyean) Thu, 24 Jan 2013 21:30:56 +0000
Newsgroups php.install
Message-ID <965553E85C23E046AFF79C31818A4F2349E3CCBB@BL2PRD0510MB361.namprd05.prod.outlook.com>
Hey guys,

Found something interesting here. It seems that flush works differently in PHP5.3 and I am trying to understand the change. Below is a small snippet of code:

<?php

echo 'a';
sleep(10);
?>


In php 5.2 running `$>php file.php` with this code in it, the 'a' prints almost immediately. In php-5.3.15 doing the same thing, it sleeps for 10 seconds then prints the 'a'. I ran an strace on this command and it also reflects this change. I have already verified that output buffering is disabled on both systems to rule that out. Any thoughts?

PHP 5.2:
write(1, "a", 1a)                        = 1
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigaction(SIGCHLD, NULL, {SIG_DFL, [], 0}, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
nanosleep({10, 0},
{10, 0})             = 0

PHP 5.3:
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
nanosleep({10, 0},
{10, 0})             = 0
write(1, "a", 1a)                        = 1
gettimeofday({1359049071, 137281}, NULL) = 0