Running a php script in the background in Windows

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 php script in the background in Windows

Post by mrhoopz »

I'm trying to take one of my php scripts and run it in the background. I've seen a lot of posts on how to do this, and it seems like the following should work, but it's not.

Code: Select all

exec ("startJob.php > /dev/null &");
I think it might be due to the fact that I'm using Windows. I found one work around, which is to use a batch file as a wrapper for the php script and then just call the batch file, but I have quite a few POST variables and I have no idea how to get them all from the calling script to the batch file and then to startJob.php.

I was hoping someone might be able to tell me of an easier way to do this, i.e. without using a batch file.

Thanks


edit: i'm thinking that using ajax should work, although that's probably not the best solution
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Post by Kieran Huggins »

check out http://php.net/pcntl - it's probably what you're looking for.

also, if you're on Windows there's no such thing as /dev/null, also there's likely no application handler for .php files.
Post Reply