note 35731 added to function.exec

From: Date: Fri, 12 Sep 2003 13:24:47 +0000
Subject: note 35731 added to function.exec
Groups: php.notes 
Request: Send a blank email to php-notes+get-56391@lists.php.net to get a copy of this message
On WinXP with Apache2 and PHP 4.3.3 you cannot start a program in background with exec and start. you have to do the following. This function should work on Windows and Unix, too. 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 &"); } } } I have this tested in Win XP and SUSE Linux with Apache and PHP 4.3.3. ---- Manual Page -- http://www.php.net/manual/en/function.exec.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+35731 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+35731&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+35731&report=yes

« previous php.notes (#56391) next »