On 19 October 2010 18:50, Ferdi <ferdinand.s@xxxxxxxxx> wrote: > Hi List, > > I have a php page that updates data from one database to another when it is > run. > My query is, how can I trigger the execution of this update page from > another php / javascript without the calling page having to wait for the > update page to finish? > Basically, I think the update page needs to use: > ignore_user_abort(1); > set_time_limit(0); // I don't think the script will take more than 1 min. > > At the other end I found this: > 1) > http://www.mindraven.com/blog/php/run-a-php-script-in-the-background-using-ajax/ > 2) On that page a user suggested using *pclose(popen(‘/usr/bin/php > /path/to/something.php > /dev/null &’, ‘r’)* > * *However, I need this to be usable on windows servers also. > 3) Finally, would pcntl_exec, pcntl_fork, exec or something be useful for > me? > > Which of the above 3 options is the better one? > Other suggestions are welcome :) > > Hi List, Sorry this took so long, but I wanted to close the loop (and maybe ease some one else's trouble :-)). I didn't think much about the die(header('Location: run_this_even_if_user_aborts.php')) call I was actually using to get this working. When I carefully looked up php.net for header, I realised it was a browser redirect! Now wonder the script would work some times but not always. It's clear now that every time the script worked was because I waited long enough for the browser to be redirected before killing the page. I finally settled on using jquery's ajax calls. Thanks once again to the repliers. Ferdi