ID: 26657 Updated by: [EMAIL PROTECTED] Reported By: dave at theholdens dot net -Status: Open +Status: Feedback -Bug Type: *General Issues +Bug Type: Program Execution Operating System: Win2K Server PHP Version: 4.3.4 New Comment:
Please try using this CVS snapshot: http://snaps.php.net/php4-STABLE-latest.tar.gz For Windows: http://snaps.php.net/win32/php4-win32-STABLE-latest.zip And are you aware that you're now calling com 2 times? (exec() in PHP does 'cmd /c' itself) Previous Comments: ------------------------------------------------------------------------ [2003-12-17 17:12:47] dave at theholdens dot net Description: ------------ I have been trying to use exec() to run a legacy 16-bit DOS .EXE program to peform a complex calculatation that involves looking stuff up in dbase tables. It refuses to work. I have checked everything including permissions, paths, php.ini Safe Mode settings, etc. All of the security is basically turned off. The really curious behaviour is that my exec function call works fine for system commands like ipconfig and dir, but does not work for my DOS program, even when I move it into the windows\system32 directory beside all of the commands that DO work. I have checked that the DOS program is sending back appropriate return codes. The DOS program works fine when I type in the exact string being passed to the shell from the command line. The same php code ran fine on a RedHat 8.x box, but broke when moved to Windows 2K3 server. Reproduce code: --------------- // this works fine $output = exec("cmd /C ipconfig", $out_lines, $ret_code); for($ctr=0; $ctr < count($out_lines); $ctr++) echo $out_lines[$ctr] . "<br>"; // this does not work (and grep.com IS copied to win\s32 dir and given ALL permissions for EVERYONE) $output = exec("cmd /C c:\\windows\\system32\\grep -i \"safe\" c:\\windows\\php.ini", $out_lines, $ret_code); for($ctr=0; $ctr < count($out_lines); $ctr++) echo $out_lines[$ctr] . "<br>"; Expected result: ---------------- The "works fine" code shows the ipconfig output stream exactly as expected and $ret_code contains 0. Actual result: -------------- The "doesn't work" code shows nothing. The $out_lines array is empty and $ret_code contains 1. No errors appear in the log or the web page, even though error logging is turned on for both. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=26657&edit=1
