background program executing without halting the php-script

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
lnp80
Forum Newbie
Posts: 7
Joined: Thu Mar 31, 2005 1:26 pm

background program executing without halting the php-script

Post by lnp80 »

Hello

I am writing a php-program that needs to be able to start off another program (test.py) and having this running in the background without halting the initial php-program. I also need to control the python program running in the background and be able to kill it at any time (need the process ID of the python program)

In my attemt so far i have succeeded to fork of a python program running in the background without halting the php-program.
My code for this is as follows:

Code: Select all

$WshShell = new COM("WScript.Shell");
$oExec = $WshShell->Run('python test.py', 3, false);
Is there any way to get the process ID of the python program test.py, or should i be dooing this in some other way?

(I am using Windows XP)

Hope someone can halp me with my problem

Regards
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

why not just use shell_exec() ?
Post Reply