From:             dave at theholdens dot net
Operating system: Win2K Server
PHP version:      4.3.4
PHP Bug Type:     *General Issues
Bug description:  exec() strange behaviour

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 bug report at http://bugs.php.net/?id=26657&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=26657&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=26657&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=26657&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=26657&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=26657&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=26657&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=26657&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=26657&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=26657&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=26657&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=26657&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=26657&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26657&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=26657&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=26657&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=26657&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=26657&r=float

Reply via email to