RE: [PHP] Script timeout?
| From: | jon roig | Date: | Tue, 27 Jan 2004 15:37:44 +0000 |
| Subject: | RE: [PHP] Script timeout? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-175927@lists.php.net to get a copy of this message | ||
Two ways we deal with long running scripts like this are:
1) Run it from the command line. Usually, PHP drives web pages... But it
can be used as a scripting language just like perl. Beginning the script
with set_time_limit(0) kills the timeout. Also, running from the command
line gets around all the weird browser display issues that one sometimes
sees.
2) Mark your place as you go. Maybe include a field called something
like lastSent. When each email goes out, mark it. That way, you can
recover it later if something happens.
-- jon
-------------------
jon roig
web developer
email: jon@trafficdesigns.com
phone: 888.230.7557
-----Original Message-----
From: memoimyself@yahoo.com.br [mailto:memoimyself@yahoo.com.br]
Sent: Tuesday, January 27, 2004 7:36 AM
To: php-general@lists.php.net
Subject: Re: [PHP] Script timeout?
Hello Ben,
On 27 Jan 2004 at 9:27, Ben Ramsey wrote:
> I'm trying to run a query against a database with a PHP script that
> cycles through each record (about 4,000+) and sends and e-mail to them
> if they have an e-mail address present. The problem is that everytime
I
> do this, it processes about 430 records and stops. There is no error
> message generated. Could this be due to a script timeout? If so, how
> do I raise the timeout value?
Look up set_time_limit in the PHP manual. Also, consider retrieving all
the records first
with a single db query, storing all e-mails in an array, and then
sending out the e-mails
in a separate operation. Why query your db 4000+ times when you can
query it only
once?
Good luck,
Erik
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.564 / Virus Database: 356 - Release Date: 1/19/2004
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.564 / Virus Database: 356 - Release Date: 1/19/2004