36

I want to send hundreds of emails using PHP. To increase the execution time, I used ini_set('max_execution_time', 10); but after sending just 30 emails the browser shows me a blank page and does not send all of the emails.

I also changed the limit to 300, 600 ..

Really Nice Code
  • 968
  • 1
  • 11
  • 20
PHP Ferrari
  • 15,038
  • 26
  • 81
  • 147
  • 2
    Watch out for web server timeout, 'cos I'm guessing you're running this via a web request; and this type of task should really be executed CLI via a cron task – Mark Baker Feb 28 '11 at 15:54

1 Answers1

43

Try set_time_limit(0); at the top of your script.

set_time_limit sets the maximum execution time in seconds. If set to zero, no time limit is imposed (see PHP manual).

Al.G.
  • 4,175
  • 6
  • 34
  • 55
Richard Pianka
  • 3,257
  • 2
  • 27
  • 34
  • Thanks, glad that i know i should place it on first invoked script. Not the second one. Kindly explain why it have to be the first? – Adi Prasetyo Nov 05 '17 at 12:59