View Full Version : changing the overall page execution timeout.

09-09-2009, 04:48 PM

I've been working on a script to mailshot my clients from a mysql database, which contains quite a lot of email addresses, about 1000 to be exact. As you may know, this could take a lot of script processing time.

My webhost wont increase any timeouts to more than 30 seconds for 'security reasons' but I have managed to get around this with ini_set's for max_execution_time and mysql.connect_timeout within the script, which have worked.

But now I get a 'page cannot be found' error if the process takes longer than about 30/40 seconds.

SO... I have managed to set the script execution times long enough... but is there a way to increase the execution time of the actual page? I think with asp there is an http runtime executionTimeout or something, but is there anything similar in php? or general html?

I could split the email addresses down into batches of 100 and re-direct the page if it hasent sent to all of them yet, but i thought I would check if there was a better way first?

Any help is appreciated! Thanks! :)

09-09-2009, 05:11 PM
You're probably timing out because of an apache setting, and not a php setting at this point.

Your best bet is probably to set up some type of queuing system and send out small chunks of emails rather than 1000 at a time.

09-10-2009, 09:13 AM
Thanks bcarl, I thought that might be best... Would that be like I said, with doing 100 at a time and then automatically refreshing the page to do the next 100?

Ive also come across the ignore_user_abort(true); function. would this work?