![]() |
php server gurus
I want this to output '.' as it goes, but some output buffering is taking place and it waits to finish the whole thing before there's any output.
Server runs Apache 2.2.9, no gzip or deflate php 5.2.6 in php.ini; output_buffering = Off implicit_flush = On Code:
<?php |
Code:
<?php if your server doesn't do the same, compare the headers of: http://borkedcoder.com/flush.php with your server. Mine are: Date: Sun, 28 Feb 2010 08:09:51 GMT Server: Apache Vary: Accept-Encoding Content-Encoding: gzip Connection: close Transfer-Encoding: chunked Content-Type: text/html; charset=UTF-8 200 OK |
Thanks for the response.
I loaded your page, I'm still waiting for it to output anything. The usleep(25000) is only 0.025 seconds vs sleep(10) which is 10 seconds. My headers: HTTP/1.1 200 OK Date: Sun, 28 Feb 2010 08:26:04 GMT Server: Apache Content-Type: text/html |
Ah! I just tried it in Firefox and it works there, so it must be a Mac Safari and Mac Chrome difference and not server or code related.
|
That's interesting - I didn't know the browsers handled output differently. Indeed Safari is waiting for everything before outputting.
And yup, I changed usleep to sleep cos I though the time was too quick for a browser to capture each flush separately, but then was waiting forever, so consider that remark as me talking to myself ;) So, looks like nothing you can do there if it's the browser handling that's the problem. |
try adding this line
set_time_limit(0); |
http://www.ape-project.org/ - check that out.
|
answer him
|
I thought about using AJAX, but just wondered why the php solution wasn't working. There's nothing wrong with the code, it's just the browser differences.
If you pad about 1,000 space characters with some new lines or other characters first, it starts to flush the output for the other browsers. No need for extra flush() or ob_flush(), and set_time_limit isn't necessary. |
All times are GMT -7. The time now is 03:42 PM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123