Ok, I'm not positive I'm right here, but have you thought about the 
browser timing out - and not PHP? You may try doing an echo(" "); and a 
flush(); every 100 e-mails or so - and reset max exec time to a 
reasonable duration while you're at it - that *might* fix it. Please 
note that executing set_time_limit() also resets the timer, so 
set_time_limit(20) every 100 e-mails should be more than enough.



Daren Cotter wrote:
> I have a PHP script that queries a MySQL database,
> retrieves email addresses, and sends an email to all
> members of a website.
> The problem is this: the PHP script times out after
> sending about 5,000 mailings, and I have to restart it
> 10 times in order to mail the entire list!
> This is an ongoing problem I have had for almost a
> year now. I have tried MANY things to make this work
> better, which I have outlined below:
> 1) Upped the Max Excecution Time in PHP from 30 to a
> ridiculously high 300 (is this a security issue?)
> 2) Upped the Max amount of memory a PHP script can
> have from 8mb to 16mb
> 3) Running sendmail in "deferred" mode instead of
> "background" mode, and processing the mail queue ever
> 5 minutes instead of the default 1 hour.
> Results:
> 1) The script runs much longer, but still times out.
> (One thing I want to make clear, even when max
> execution time is 30 seconds, the script does not stop
> after 30 seconds, maybe it just means 30 seconds of
> inactivity?)
> 2) I have no idea if this is making a difference or
> not, does anyone know?
> 3) Since this means mailings get sent right into the
> queue, and not sent right away, the HTTP interface
> runs 10 times faster. This would be a GREAT solution
> for me, but it has one drawback: when a user signs up
> for the site, their confirmation email must be sent
> immediately...it cannot sit in the queue until the
> next time the queue is processed (at most 5 minutes).
> So, I figure I have two options. Leave sendmail as set
> to deferred, process the queue every so often, but
> find a way to have the confirmation emails sent
> immediately. This is really the option I want to do.
> The sendmail version I have (latest version), has 4
> separate mail queues. Does anyone know how to use PHP
> to stipulate that some mailings get sent immediately,
> while others are just queued until the next queue run?
> Otherwise, I have to set the delivery method of
> sendmail back to background, have mailings take 10
> times as long from the HTTP interface, and try and
> find some way from keeping the script from timing out
> and having to restart the mailing.
> ANY HELP is greatly appreciated!
> BTW, the server is loaded, dual proc, gig of ram,
> etc...more hardware has not helped the problem.
> __________________________________________________
> Do You Yahoo!?
> HotJobs - Search Thousands of New Jobs
> http://www.hotjobs.com

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

Reply via email to