Re: Execute a php page and don't wait for it to finish
| From: | Sebastian Detert | Date: | Tue, 19 Oct 2010 13:51:15 +0000 |
| Subject: | Re: Execute a php page and don't wait for it to finish | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-308833@lists.php.net to get a copy of this message | ||
Ferdi schrieb:
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’)*2) Maybe http://robert.accettura.com/blog/2006/09/14/asynchronous-processing-with-php/ could help you, but I never tried that.* *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 :) Thanks and Regards, Ferdi 1) I guess an asynchronous ajax request is what you are looking for. But it won't work on command line.