PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I have a PHP scripts that needs to perform a lot of work.
I need to make sure that the script will never timeout and will never stop its execution in the middle.
I tried something like:
ini_set('max_execution_time', 36000); // 10 hours
set_time_limit(0);
$original_ignore_user_abort = ignore_user_abort(false);
// a lot of work here....
ignore_user_abort($original_ignore_user_abort);
However, sometimes it doesn't work, and the script stops after a while.
Am I doing something wrong? Can anyone suggest a better approach?
Are you running this via the command line? If so, there is no timeout.
Check your log like ~feyd said. If that turns up nothing, dump a bunch of output from different points in your script to see what gets executed & what doesn't.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Many shared hosting serviced have the ability to set the timeout disabled. You can try to set it but it never really changes it. They do this to prevent one of the shared clients from taking over a server with a run away program.