PHP on a windows machine; Start process in background then Kill process

magicdude1

New Member
I'm looking for the best, or any way really to start a process from php in the background so I can kill it later in the script.Right now, I'm using: shell_exec($Command);The problem with this is it waits for the program to close.I want something that will have the same effect as nohup when I execute the shell command. This will allow me to run the process in the background, so that later in the script it can be closed. I need to close it because this script will run on a regular basis and the program can't be open when this runs.I've thought of generating a .bat file to run the command in the background, but even then, how do I kill the process later?The code I've seen for linux is:$PID = shell_exec("nohup $Command > /dev/null & echo $!");// Later on to kill itexec("kill -KILL $PID");EDIT: Turns out I don't need to kill the process
 
Back
Top