Page 1 of 1

Running a php script in the background in Windows

Posted: Tue Feb 27, 2007 1:17 pm
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

Posted: Tue Feb 27, 2007 1:37 pm
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.