Re: exec() or system() to run *.exe and let php continue with code

From: Date: Fri, 29 Oct 2004 12:49:33 +0000
Subject: Re: exec() or system() to run *.exe and let php continue with code
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-200622@lists.php.net to get a copy of this message
> Hi all im new to PHP and im trying to let a process (*.exe file) to run in > background(localhost) and let php continue processing the script. But PHP > always stops and wait for the (*.exe) stops/close! > > Anyone here can help me by giving me an simply example to let PHP run the > exe file and continue with code execution. check out http://us2.php.net/manual/en/function.exec.php read through the user comments found this on php.net function execInBackground($path, $exe, $args = "") { global $conf; if (file_exists($path . $exe)) { chdir($path); if (substr(php_uname(), 0, 7) == "Windows"){ pclose(popen("start \"bla\" \"" . $exe . "\" " . escapeshellarg($args), "r")); } else { exec("./" . $exe . " " . escapeshellarg($args) . " > /dev/null &"); } } }

« previous php.general (#200622) next »