I had a lot of problems with a similar process under the windows; My situation was slightly different from the fact that I didnβt care about the βscriptβ reaction - I wanted the script to run and allow other page requests to go through while it was busy with work.
For some reason; I had problems with it, either hanging other requests, or the time runs out after 60 seconds (both apache and php were set to timeout after about 20 minutes); It also turns out that firefox shuts down after 5 minutes (by default), so after this point you cannot know what is going on through the browser without changing the settings in firefox.
I ended up using an open process and processed closing methods to open php in cli mode as follows:
pclose(popen("start php myscript.php", "r"));
This (using start) will open the php process and then kill the startup process by running php so that it works for a long time - again you would need to kill the process to manually close it. You did not need to set any timeouts, and you could let the current page that called it continue and provide some details.
The only problem is that if you need to send the script any data, you will either do it through another source, or pass it on the "command line" as parameters; which is not so safe.
Works well for what we need, and ensures that the script always runs and can run without any interruptions.
Christopher Lightfoot Nov 05 '08 at 14:13 2008-11-05 14:13
source share