FastCGI + PHP + Apache/Apache2 buffering issue
Theodor Milkov <[email protected]>
| Newsgroups | gmane.comp.web.fastcgi.devel |
|---|---|
| Message-ID | <[email protected]> |
Hello,
I have a PHP application that streams some data in real time and hence requires
unbuffered operation. However I'm unable to turn off buffering while using both
apache and apache2. I've tried to use flush() and ob_flush(), setting
output_buffering to Off and php.ini but none of these seems to help.
On the other hand I've tried lighttpd + fastcgi + php and it works just fine.
I'm using the following simple test script:
<?php
for ($i=0; $i<4; $i++){
echo "$i\n";
sleep (1);
}
?>
And strace of php process looks like:
read(4, "<?php\n\tfor ($i=0; $i<4; $i++){\n\t"..., 8192) = 65
read(4, "", 4096) = 0
read(4, "", 8192) = 0
close(4) = 0
munmap(0x4056b000, 4096) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigaction(SIGCHLD, NULL, {SIG_DFL}, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
nanosleep({1, 0}, {1, 0}) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigaction(SIGCHLD, NULL, {SIG_DFL}, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
nanosleep({1, 0}, {1, 0}) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigaction(SIGCHLD, NULL, {SIG_DFL}, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
nanosleep({1, 0}, {1, 0}) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigaction(SIGCHLD, NULL, {SIG_DFL}, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
nanosleep({1, 0}, {1, 0}) = 0
setitimer(ITIMER_PROF, {it_interval={0, 0}, it_value={0, 0}}, NULL) = 0
write(3, "\1\6\0\1\0@\0\0Content-type: text/html\r"..., 96) = 96
I.e. there are 4 calls to sleep and the script output is writen at once. Any
pointers to documentation or further tests that I should perform are welcome.
It seems like it's more php issue than fastcgi but php used as an ordinary CGI
or mod_php behave as expected.
Using google I wasn't able to find other people with similar problems so may be
it's me doing something wrong.
Kindest regards,
Theodor
___________________________________
fastcgi-developers mailing list
http://fastcgi.com/fastcgi-developers/