PHP Background Processes

background-processPHP

I'm trying to make a PHP script, I have the script finished but it takes like 10 minutes to finish the process it is designed to do. This is not a problem, however I presume I have to keep the page loaded all this time which is annoying. Can I have it so that I start the process and then come back 10mins later and just view the log file it has generated?

Best Answer

Well, you can use "ignore_user_abort(true)"

So the script will continue to work (keep an eye on script duration, perhaps add "set_time_limit(0)")

But a warning here: You will not be able to stop a script with these two lines:

ignore_user_abort(true); 
set_time_limit(0);

Except you can directly access the server and kill the process there! (Been there, done an endless loop, calling itself over and over again, made the server come to a screeching stop, got shouted at...)