Script Doesnt Run All the Way Through
- by Chris
I have a php script that should execute 2 for loops. Both take awhile to run. I have called ignore_user_abort(true) and set_time_limit(0). The interesting thing is, the first for loop completes, then the script dies without calling the next line of code.
ignore_user_abort(true);
set_time_limit(0);
for($i=0; $i<10500; ++$i) {
//do work
}
mail('[email protected]', 'First loop done', 'None');
for($j=0;$j<12500; ++$j) {
//do work
}
mail('[email protected]', 'Second loop done', 'None');
The first loop will finish after about 20 minutes, but the mail function is never called, the script just ends. Any ideas why this might be happening other than a timeout (I have run other scripts for days on my current configuration)?