Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
02-27-2010, 09:13 PM | #1 |
Beer Money Baron
Industry Role:
Join Date: Jan 2001
Location: brujah / gmail
Posts: 22,157
|
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 ob_implicit_flush(true); ob_end_flush(); $i = 0; while($i++ < 100) { echo '.'; usleep(25000); if ($i%10==0) echo "\n<br />"; }
__________________
|
02-28-2010, 01:17 AM | #2 |
Totally Borked
Industry Role:
Join Date: Feb 2005
Posts: 6,284
|
Code:
<?php ob_implicit_flush(true); ob_end_flush(); flush(); $i = 0; while($i++ < 100) { echo '.'; sleep(10); flush(); if ($i%10==0) echo "\n<br />"; } ?> 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
__________________
For coding work - hit me up on andy // borkedcoder // com (consider figuring out the email as test #1) All models are wrong, but some are useful. George E.P. Box. p202 |
02-28-2010, 01:31 AM | #3 |
Beer Money Baron
Industry Role:
Join Date: Jan 2001
Location: brujah / gmail
Posts: 22,157
|
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
__________________
|
02-28-2010, 01:34 AM | #4 |
Beer Money Baron
Industry Role:
Join Date: Jan 2001
Location: brujah / gmail
Posts: 22,157
|
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.
__________________
|
02-28-2010, 01:59 AM | #5 |
Totally Borked
Industry Role:
Join Date: Feb 2005
Posts: 6,284
|
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.
__________________
For coding work - hit me up on andy // borkedcoder // com (consider figuring out the email as test #1) All models are wrong, but some are useful. George E.P. Box. p202 |
02-28-2010, 02:22 AM | #6 |
Too lazy to set a custom title
Industry Role:
Join Date: Sep 2005
Location: Springfield
Posts: 13,826
|
try adding this line
set_time_limit(0);
__________________
Make a bank with Chaturbate - the best selling webcam program Ads that can't be block with AdBlockers !!! /// Best paying popup program (Bitcoin payouts) !!! PHP, MySql, Smarty, CodeIgniter, Laravel, WordPress, NATS... fixing stuff, server migrations & optimizations... My ICQ: 27429884 | Email: |
02-28-2010, 07:08 AM | #7 |
Confirmed User
Join Date: May 2004
Location: SW Palm Bay, Florida
Posts: 1,323
|
http://www.ape-project.org/ - check that out.
__________________
subarus. |
02-28-2010, 07:45 AM | #8 |
Confirmed User
Industry Role:
Join Date: Sep 2007
Posts: 6,497
|
answer him
__________________
Adult SEO Labs * Buying Links * SEO 666-874 |
02-28-2010, 12:51 PM | #9 |
Beer Money Baron
Industry Role:
Join Date: Jan 2001
Location: brujah / gmail
Posts: 22,157
|
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.
__________________
|