Running a process in the background

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mrhoopz
Forum Newbie
Posts: 11
Joined: Tue Feb 06, 2007 1:35 pm

Running a process in the background

Post 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!
User avatar
kaszu
Forum Regular
Posts: 749
Joined: Wed Jul 19, 2006 7:29 am

Post by kaszu »

mrhoopz
Forum Newbie
Posts: 11
Joined: Tue Feb 06, 2007 1:35 pm

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

There's nothing you can do directly. Indirectly, the external program can update a file or something, maybe.
Post Reply