Re: [PHP] set_time_limit() in a loop

2002-01-28 Thread DL Neil

Matthew,

There's some strange stuff going on here, and in the conversation.

For information about set_time_limit() please read 
http://uk2.php.net/manual/en/function.set-time-limit.php.
Despite the sense of what is written below, the manual says When called, 
set_time_limit() restarts the
 timeout counter from zero. In other words, if the timeout is the
 default 30 seconds, and 25 seconds into script execution a call
 such as set_time_limit(20) is made, the script will run for a
 total of 45 seconds before timing out.
Accordingly, every loop of the script is asking for the time_limit to be imposed in 30 
minutes' time.

The foibles of mail() are well documented on this list - please check the archives. 
The most pertinent comment
being that mail() does not suit volume transmissions, and bulk-mailer software should 
be used instead. In your
case, personalisation makes that a little more difficult.

Do you have any idea how far through the mail out is the script getting before it 
stops/stalls/bombs/cycles
aimlessly? If not, why not?

The previous respondent asked you for the exit criteria for your while loop. The code 
example below is not pure
PHP. Again: what is it - show us the code.

Are you suffering this problem on a production machine, but not on your development 
machine, ie do we have
machine-differences to take into account?

Have you tried commenting out the mail() command and replacing it with an ECHO To 
address (and perhaps a
counter) to see just how far the script gets?

If that works perfectly, then questions have to be asked about mail() and the email 
server being used... at the
moment all the questions center on what you are ACTUALLY doing.

Please advise,
=dn




 Thanks for your reply Paul.

 The script is getting subscriber details from a database and then
 firing our personalised emails in HTML and text format. The while
 statement loops through the query results and fires out the emails
 using the mail() command.

 It works well so far and indeed does finish the loop OK - but as
 mentioned the script is still running 13 hours later. I don't get it.

 Any ideas? Is it possible to kill a script via PHP code?

 Matthew

 PS Here is the script again

 ?
  ignore_user_abort(true);
  set_time_limit(1800);
  while:
 personalise the message;
   mail();
 set_time_limit(1800);
  endwhile;
 ?

 -Original Message-
 From: Paul Roberts [mailto:[EMAIL PROTECTED]]
 Sent: Sunday, January 27, 2002 12:08 AM
 To: Matthew Delmarter
 Cc: PHP Mailing List
 Subject: Re: [PHP] set_time_limit() in a loop


 what are you doing a while on

 if while never ends and you reset the time out each loop and use
 ignore_user_abort(true), it will still be going 13 hours latter.

 maybe if you send the full code so we can look at it.

 Paul Roberts
 [EMAIL PROTECTED]
 
 - Original Message -
 From: Matthew Delmarter [EMAIL PROTECTED]
 To: Martin Towell [EMAIL PROTECTED]
 Cc: PHP Mailing List [EMAIL PROTECTED]
 Sent: Friday, January 25, 2002 12:55 AM
 Subject: RE: [PHP] set_time_limit() in a loop


  I should also mention that the loop is sending mail using mail().
 
  Is it possible that this is the problem somehow?
 
  -Original Message-
  From: Martin Towell [mailto:[EMAIL PROTECTED]]
  Sent: Friday, January 25, 2002 1:16 PM
  To: 'Matthew Delmarter'; PHP Mailing List
  Subject: RE: [PHP] set_time_limit() in a loop
 
  your first thought was correct - it sets it to 1800, it's NOT
  accumulative.
 
  it would have something to do with  ignore_user_abort(true); and
 also
  is your while loop's exit check working?
 
  Martin
 
 
  -Original Message-
 
  Just wondering about set_time_limit() in a loop.
 
  The current code looks something like this:
 
  ?
   ignore_user_abort(true);
   set_time_limit(1800);
   while:
  do stuff;
  set_time_limit(1800);
   endwhile;
  ?
 
  Does this reset the timeout to 1800 seconds every time it loops? Or
  does it accumulate so that the timeout has 1800 seconds added to it
  every time?
 
  The reason I ask is that my ISP informs me that the script is still
  running 13 hours later! Or is this related to the ignore_user_abort?
 
  Regards,
  Matthew Delmarter
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail:
  [EMAIL PROTECTED]
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail:
 [EMAIL PROTECTED]
 
 
 



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e

RE: [PHP] set_time_limit() in a loop

2002-01-27 Thread Matthew Delmarter

Thanks for your reply Paul.

The script is getting subscriber details from a database and then
firing our personalised emails in HTML and text format. The while
statement loops through the query results and fires out the emails
using the mail() command.

It works well so far and indeed does finish the loop OK - but as
mentioned the script is still running 13 hours later. I don't get it.

Any ideas? Is it possible to kill a script via PHP code?

Matthew

PS Here is the script again

?
 ignore_user_abort(true);
 set_time_limit(1800);
 while:
personalise the message;
  mail();
set_time_limit(1800);
 endwhile;
?

-Original Message-
From: Paul Roberts [mailto:[EMAIL PROTECTED]]
Sent: Sunday, January 27, 2002 12:08 AM
To: Matthew Delmarter
Cc: PHP Mailing List
Subject: Re: [PHP] set_time_limit() in a loop


what are you doing a while on

if while never ends and you reset the time out each loop and use
ignore_user_abort(true), it will still be going 13 hours latter.

maybe if you send the full code so we can look at it.

Paul Roberts
[EMAIL PROTECTED]

- Original Message -
From: Matthew Delmarter [EMAIL PROTECTED]
To: Martin Towell [EMAIL PROTECTED]
Cc: PHP Mailing List [EMAIL PROTECTED]
Sent: Friday, January 25, 2002 12:55 AM
Subject: RE: [PHP] set_time_limit() in a loop


 I should also mention that the loop is sending mail using mail().

 Is it possible that this is the problem somehow?

 -Original Message-
 From: Martin Towell [mailto:[EMAIL PROTECTED]]
 Sent: Friday, January 25, 2002 1:16 PM
 To: 'Matthew Delmarter'; PHP Mailing List
 Subject: RE: [PHP] set_time_limit() in a loop

 your first thought was correct - it sets it to 1800, it's NOT
 accumulative.

 it would have something to do with  ignore_user_abort(true); and
also
 is your while loop's exit check working?

 Martin


 -Original Message-

 Just wondering about set_time_limit() in a loop.

 The current code looks something like this:

 ?
  ignore_user_abort(true);
  set_time_limit(1800);
  while:
 do stuff;
 set_time_limit(1800);
  endwhile;
 ?

 Does this reset the timeout to 1800 seconds every time it loops? Or
 does it accumulate so that the timeout has 1800 seconds added to it
 every time?

 The reason I ask is that my ISP informs me that the script is still
 running 13 hours later! Or is this related to the ignore_user_abort?

 Regards,
 Matthew Delmarter



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail:
 [EMAIL PROTECTED]



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail:
[EMAIL PROTECTED]






-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] set_time_limit() in a loop

2002-01-26 Thread Paul Roberts

what are you doing a while on

if while never ends and you reset the time out each loop and use
ignore_user_abort(true), it will still be going 13 hours latter.

maybe if you send the full code so we can look at it.

Paul Roberts
[EMAIL PROTECTED]

- Original Message - 
From: Matthew Delmarter [EMAIL PROTECTED]
To: Martin Towell [EMAIL PROTECTED]
Cc: PHP Mailing List [EMAIL PROTECTED]
Sent: Friday, January 25, 2002 12:55 AM
Subject: RE: [PHP] set_time_limit() in a loop


 I should also mention that the loop is sending mail using mail().
 
 Is it possible that this is the problem somehow?
 
 -Original Message-
 From: Martin Towell [mailto:[EMAIL PROTECTED]]
 Sent: Friday, January 25, 2002 1:16 PM
 To: 'Matthew Delmarter'; PHP Mailing List
 Subject: RE: [PHP] set_time_limit() in a loop
 
 your first thought was correct - it sets it to 1800, it's NOT
 accumulative.
 
 it would have something to do with  ignore_user_abort(true); and also
 is your while loop's exit check working?
 
 Martin
 
 
 -Original Message-
 
 Just wondering about set_time_limit() in a loop.
 
 The current code looks something like this:
 
 ?
  ignore_user_abort(true);
  set_time_limit(1800);
  while:
 do stuff;
 set_time_limit(1800);
  endwhile;
 ?
 
 Does this reset the timeout to 1800 seconds every time it loops? Or
 does it accumulate so that the timeout has 1800 seconds added to it
 every time?
 
 The reason I ask is that my ISP informs me that the script is still
 running 13 hours later! Or is this related to the ignore_user_abort?
 
 Regards,
 Matthew Delmarter
 
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail:
 [EMAIL PROTECTED]
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 
 




RE: [PHP] set_time_limit() in a loop

2002-01-24 Thread Martin Towell

your first thought was correct - it sets it to 1800, it's NOT accumulative.

it would have something to do with  ignore_user_abort(true); and also is
your while loop's exit check working?

Martin


-Original Message-
From: Matthew Delmarter [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 25, 2002 11:20 AM
To: PHP Mailing List
Subject: [PHP] set_time_limit() in a loop


Just wondering about set_time_limit() in a loop.

The current code looks something like this:

?
 ignore_user_abort(true);
 set_time_limit(1800);

 while:
do stuff;
set_time_limit(1800);
 endwhile;
?

Does this reset the timeout to 1800 seconds every time it loops? Or
does it accumulate so that the timeout has 1800 seconds added to it
every time?

The reason I ask is that my ISP informs me that the script is still
running 13 hours later! Or is this related to the ignore_user_abort?

Regards,

Matthew Delmarter



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



RE: [PHP] set_time_limit() in a loop

2002-01-24 Thread Matthew Delmarter

Thanks for your reply Martin.

Any ideas why ignore_user_abort would cause this problem?


-Original Message-
From: Martin Towell [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 25, 2002 1:16 PM
To: 'Matthew Delmarter'; PHP Mailing List
Subject: RE: [PHP] set_time_limit() in a loop

your first thought was correct - it sets it to 1800, it's NOT
accumulative.

it would have something to do with  ignore_user_abort(true); and also
is your while loop's exit check working?

Martin


-Original Message-

Just wondering about set_time_limit() in a loop.

The current code looks something like this:

?
 ignore_user_abort(true);
 set_time_limit(1800);
 while:
do stuff;
set_time_limit(1800);
 endwhile;
?

Does this reset the timeout to 1800 seconds every time it loops? Or
does it accumulate so that the timeout has 1800 seconds added to it
every time?

The reason I ask is that my ISP informs me that the script is still
running 13 hours later! Or is this related to the ignore_user_abort?

Regards,
Matthew Delmarter



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail:
[EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] set_time_limit() in a loop

2002-01-24 Thread Matthew Delmarter

I should also mention that the loop is sending mail using mail().

Is it possible that this is the problem somehow?

-Original Message-
From: Martin Towell [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 25, 2002 1:16 PM
To: 'Matthew Delmarter'; PHP Mailing List
Subject: RE: [PHP] set_time_limit() in a loop

your first thought was correct - it sets it to 1800, it's NOT
accumulative.

it would have something to do with  ignore_user_abort(true); and also
is your while loop's exit check working?

Martin


-Original Message-

Just wondering about set_time_limit() in a loop.

The current code looks something like this:

?
 ignore_user_abort(true);
 set_time_limit(1800);
 while:
do stuff;
set_time_limit(1800);
 endwhile;
?

Does this reset the timeout to 1800 seconds every time it loops? Or
does it accumulate so that the timeout has 1800 seconds added to it
every time?

The reason I ask is that my ISP informs me that the script is still
running 13 hours later! Or is this related to the ignore_user_abort?

Regards,
Matthew Delmarter



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail:
[EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] set_time_limit() in a loop

2002-01-24 Thread Martin Towell

no, that shouldn't affect it - ignore_user_abort() keeps the script going
even if the user aborts (I'm assuming you already knew that...) so the only
thing that I can think of that's keeping the script going it the while loop
- check the exit condition to make sure it does actually end...

Martin


-Original Message-
From: Matthew Delmarter [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 25, 2002 11:56 AM
To: Martin Towell
Cc: PHP Mailing List
Subject: RE: [PHP] set_time_limit() in a loop


I should also mention that the loop is sending mail using mail().

Is it possible that this is the problem somehow?

-Original Message-
From: Martin Towell [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 25, 2002 1:16 PM
To: 'Matthew Delmarter'; PHP Mailing List
Subject: RE: [PHP] set_time_limit() in a loop

your first thought was correct - it sets it to 1800, it's NOT
accumulative.

it would have something to do with  ignore_user_abort(true); and also
is your while loop's exit check working?

Martin


-Original Message-

Just wondering about set_time_limit() in a loop.

The current code looks something like this:

?
 ignore_user_abort(true);
 set_time_limit(1800);
 while:
do stuff;
set_time_limit(1800);
 endwhile;
?

Does this reset the timeout to 1800 seconds every time it loops? Or
does it accumulate so that the timeout has 1800 seconds added to it
every time?

The reason I ask is that my ISP informs me that the script is still
running 13 hours later! Or is this related to the ignore_user_abort?

Regards,
Matthew Delmarter



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail:
[EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]