Page 1 of 1

Running a process in the background

Posted: Tue Feb 06, 2007 2:40 pm
by mrhoopz
I'm new to PHP and web dev in general, and I found a lot of posts that sorta talk about this, but I figured I'd ask anyway as I've seen quite a few different ideas on doing this.

I have a page that lists a bunch of records, the user can select some of these records and submit them as a 'job'. When these records are submitted, I call an external program (currently using the exec function) to process these records and make an output file. This program can take awhile to run.

What I want to do is, when the job is submitted, go to a page that starts the program in the background from an include file, and then redirects the user to a jobs page where it will display and monitor jobs. The part that is giving me problems is starting the external program and getting it to run in the background, and after that being able to check its status.

Any help or ideas would be greatly appreciated, thanks. If there is a better way to do something like this, let me know, too!

Posted: Tue Feb 06, 2007 2:55 pm
by kaszu

Posted: Tue Feb 06, 2007 5:21 pm
by mrhoopz
Thanks, that worked well. I'm halfway there. Now, how can I check to see when/if the process has completed?

Thanks again

Posted: Tue Feb 06, 2007 5:45 pm
by feyd
There's nothing you can do directly. Indirectly, the external program can update a file or something, maybe.