Re: Need to disable buffering
"Matt" <[email protected]>
| Newsgroups | gmane.comp.web.fastcgi.devel,gmane.spam.detected |
|---|---|
| Message-ID | <[email protected]> |
First make sure that your PHP program is actually outputting information as its running rather than after it has finished so test it first outside of FastCGI. You might need to make some changes to your PHP program first. I recently had the same problem. There are many solutions, one being ob_implicit_flush() see this url for more information:
http://www.andrewdavidson.com/articles/flush-after-print/
Another solution is how(which function call) you use to execute the program in the first place. Another solution was passthru():
http://us3.php.net/manual/en/function.passthru.php
I recall some other solution was using a while loop to check to see if the program was still running and if so read from the buffer
and then output however this solution relied on php5 but I was still using php4.
The solution that was right for me in the end was this one:
$command = "some command";
system("mkfifo pipeout > /dev/null 2>&1");
$pipe = popen("$command > pipeout","w");
$pipeout = fopen("pipeout", "r");
while (!feof($pipeout))
{
$tempc = fgetc($pipeout);
if($tempc == "\n")
{
echo "<br>";
}
else
{
echo "$tempc";
}
}
Google is your friend :)
Once your PHP program is working correctly then make sure you add the -flush to the FastCGI config, refer to the manual:
http://www.fastcgi.com/mod_fastcgi/docs/mod_fastcgi.html#FastCgiServer
http://www.fastcgi.com/mod_fastcgi/docs/mod_fastcgi.html#FastCgiConfig
http://www.fastcgi.com/mod_fastcgi/docs/mod_fastcgi.html#FastCgiExternalServer
Regards,
Matt
"TSA Dave" <dave-uDgiZUplORfOdYMAhE5j1xBnub05S5/[email protected]> wrote in message news:005601c9f173$9184eab0$8c01a8c0@TSASVR4...
Greetings
Can anyone please advise how I can disable the buffering in fastCGI.
We have a Linux server running a Debian OS.
fastCGI is installed as well as php4.
Previous we were using normal CGI php4.
The php command 'flush()' that was outputting data during the php process ( normal CGI ) is now not outputting on fastCGI -- it is buffering all the data until the php process is completed, and then outputting to the browser.
How can we set the fastCGI to flush the output to the browser as it is receiving the flushed data from the php process ?
As I am a novice, could you plese tell me exactly what to add / change and in which file on the Linux server ?
Any help would be greatly appreciated.
Regards, Dave
------------------------------------------------------------------------------
_______________________________________________
FastCGI-developers mailing list
FastCGI-developers-xGejAJT2w6xVgU18Zptdi0EOCMrvLtNR@public.gmane.org
http://mailman.pins.net/mailman/listinfo.cgi/fastcgi-developers
_______________________________________________
FastCGI-developers mailing list
FastCGI-developers-xGejAJT2w6xVgU18Zptdi0EOCMrvLtNR@public.gmane.org
http://mailman.pins.net/mailman/listinfo.cgi/fastcgi-developers