ID: 28182 Updated by: [EMAIL PROTECTED] Reported By: fabiogsilva at fabio0101 dot x-br dot com -Status: Open +Status: Bogus Bug Type: Output Control Operating System: Linux/Windows PHP Version: Irrelevant New Comment:
This is a feature, not a bug. Look at the output_buffering configuration directive in your php.ini file. To disable output buffering, set this value to 0. Also, remember that some browsers (clients) will buffer input until it recieves a certain amount of data. There is nothing PHP can do about this. Previous Comments: ------------------------------------------------------------------------ [2004-04-27 17:16:01] fabiogsilva at fabio0101 dot x-br dot com To use another example, consider a script that simply prints plain text: <?php header("Content-Type: text/plain"); for($i = 0; $i < 10; $i++) { print "Line $i sent to client.\n"; sleep(1); } ?> No matter what browser we use, the result is the same. ------------------------------------------------------------------------ [2004-04-27 15:43:40] luser at uvm dot edu I can verify this on PHP 4.3.4 running on Solaris with Apache 1.3 and using Mozilla 1.6 (cause wouldn't this be really Javascript/Web browser dependent?). However, output is sent immediately from the command-line in both PHP 4.3.4 and PHP 5.0.0RC3-dev (built: Apr 26 2004 21:02:28) ------------------------------------------------------------------------ [2004-04-27 15:09:00] fabiogsilva at fabio0101 dot x-br dot com Description: ------------ To illustrate the problem, I'll write a script that sends two JavaScript blocks that capture the client's current date. I have written this code with and without buffer control, and the result is the same. Reproduce code: --------------- <script> var init_date = new Date(); </script> <? //Waiting 5 seconds to send the next JavaScript block... sleep(5); ?> <script> var end_date = new Date(); alert("Init Date: " + init_date + "\nEnd Date: " + end_date); </script> Expected result: ---------------- The two dates should not be the same, because the first block would be sent immediately, and the 2nd one 5 seconds later. Actual result: -------------- The two dates are the same. I have not experienced this problem with other languages such as ASP and Perl. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=28182&edit=1