http://dk2.php.net/manual/en/ref.exec.php -
http://dk2.php.net/manual/en/function.exec.phpDu bruger jo windows, så det er åbentbart ikke så nemt at få lov til at eksekverer aandre programmer. Men jeg fandt det her i en af kommentarene i manualen:
<snip>
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 &");
}
}
}
</snip>
Og en anden en der måske er endnu bedre:
<snip>
After searching the web for some time, I finally found out why I was getting those Unable to pork warnings. I try and still use the
"exec("cmd /c [command]", $array);"
but in Windows XP using this command is not enough. You have to enable the IUSR_xxx user to read both cmd.exe and the file you want to execute. Where xxx is replaced by your computername.
Since Simple File Sharing by default is enabled in WindowsXP you cannot give the IUSR_xxx user access to cmd.exe without doing it in a dos-command-promt.
So open up cmd.exe: Start -> Run -> cmd
use the calcs command to edit the access rights for the files.
e.g.
C:\WINDOWS\system32>cacls cmd.exe /E /G CYPRES\IUSR_CYPRES:R
since CYPRES is my computername, this is the name I will use. When you do the command replace CYPRES with your computer name.
</snip>
-Gustav Olsen