Reputation: 907
I'm running PHP on win XP and I'm using exec()
for some stuff in my program but every time the exec()
is running a cmd.exe
window is opened for a few seconds on the server. How can I make it run in the background ?
Upvotes: 0
Views: 2352
Reputation: 2848
Prefix the command with start /B
.
$process = popen("start /B ". $cmd, "r");
https://www.php.net/manual/function.exec.php#86329
Upvotes: 3
Reputation: 2045
$WshShell = new COM("WScript.Shell");
$oExec = $WshShell->Run('yourprogpath', 0, false);
Windows only.
EDIT - I think Fraxtil's answer is probably better if it works across windows and unix.
Upvotes: 1