Nexology Community
 
     
 
   

Go Back   Nexology Community > Community Zone > PHP, MySQL, CGI, Perl and CF (Linux)

Reply
 
LinkBack Thread Tools Display Modes
Old 09-15-2011, 03:24 PM   #1
Thomas Massano
 
tmassano's Avatar
 
Join Date: Sep 2011
Location: Jersey Shore
Posts: 20
PHP wait() and flush() not working

I'm trying to use Wait and Flush, but the page displays blank, then waits the appropriate time and displays everything.

The below script works properly on another web site so I know my browser is not the issue. It must be a setting in php.ini. I googled it and found all kinds of things, output_buffering, gzip etc.

I do not know enough about php.ini to know what to change, nor do I have access to it and I don’t want my provider changing things for testing.

Does someone have experience with this? Or is there a way to override my php.ini? I tried .htaccess but with no results.

Any help would be appreciated.

error_reporting(E_ALL);

// SIMULATE A LONG-RUNNING JOB WITH INTERMITTENT BROWSER OUTPUT

function my_echo($str, $pad=' ')
{
$str = str_pad($str, strlen($str) + 512, $pad);
echo $str;
echo PHP_EOL;
flush();
}

// TEST THE URL ARGUMENT FOR "b=y" AND OPTIONALLY START THE OUTPUT BUFFER
$b = (!empty($_GET["b"])) ? $_GET["b"] : NULL;
if ($b == 'y') ob_start();

// RUN THE TEST MESSAGES WAITING BETWEEN THE MESSAGES
my_echo("<br/>Hello #1");
sleep(1);
my_echo("<br/>Hello #2");
sleep(2);
my_echo("<br/>Hello #3");
sleep(3);
my_echo("<br/>Hello #4");
sleep(4);
my_echo("<br/>Hello #5");
sleep(1);
my_echo("<br/>Hello #6");
__________________
~Thomas

Wizard of smoke and mirrors technology.

http://en.wikipedia.org/wiki/Magic_smoke

http://en.wikipedia.org/wiki/Smoke_and_mirrors
tmassano is offline   Reply With Quote
Old 09-16-2011, 01:29 AM   #2
You and what a
 
RobbieLePommie's Avatar
 
Join Date: Aug 2002
Location: Sydney
Posts: 5,936
Probably mod_gzip (in Apache) as that will buffer and then compress the results. So even though PHP says "GO", mod_gzip will say "No". So that won;t be at PHP.ini level.

Might be able to to do it via .htaccess - but I've never tried. Drop a line to support to see if they can help?
__________________
Rob
----------------------------
For your information, there's a lot more to ogres than people think.
RobbieLePommie is offline   Reply With Quote
Old 09-16-2011, 06:38 AM   #3
Thomas Massano
 
tmassano's Avatar
 
Join Date: Sep 2011
Location: Jersey Shore
Posts: 20
Thanks for the tip.

I was trying to slow down a page that I use to send newsletter emails out with. But at that time I was not aware there is a limitation of 300 messages and hour by the ISP. So I have moved away from my page and installed phpList, it will allow me to do all the throttling I need. Not sure it supports DKIM yet, but maybe it will be a non-issue if I send them out slow enough.

Thanks again.
__________________
~Thomas

Wizard of smoke and mirrors technology.

http://en.wikipedia.org/wiki/Magic_smoke

http://en.wikipedia.org/wiki/Smoke_and_mirrors
tmassano is offline   Reply With Quote
Old 09-16-2011, 06:36 PM   #4
You and what a
 
RobbieLePommie's Avatar
 
Join Date: Aug 2002
Location: Sydney
Posts: 5,936
The way I do this (slow down operations) is to generate an output page saying "sent 50" with a meta refresh pointing to the same page telling it to start at 51, with a delay of 2 seconds on the refresh. This way you also know what is happening.


Your method above may also fall foul of the max execution time limit. Hope that helps for next time.
__________________
Rob
----------------------------
For your information, there's a lot more to ogres than people think.
RobbieLePommie is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 07:27 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.3.0 RC1
Copyright ©2001 - 2009, HostNexus