From:             kaufmann at brainworxx dot de
Operating system: Windows XP
PHP version:      4.3.11
PHP Bug Type:     *General Issues
Bug description:  Problem executing external programs with different methods...

Description:
------------
Hello,

I am using Apache with latest php 4 release (also tried latest php4 cvs).
I am having problems executing external programs using exec, system and
also using proc_open.

While trying to execute using exec or system, the script just hangs off
(but does not hook up the apache process).
Commands that are enabled in command.com (like dir) are working fine!

Using proc_open I encountered another problem. Executing at all works.
Executing a script from command-line works, but calling the same script
from url using apache doesn't (returns no result).
I figured out, that the default path for the programs is the apache-path,
which seems to enforce this problem.

I was unable to change the path using the cwd-option refered to on php.net
documentation. In this case the proc_open also just returns nothing.

Another problem I figured out was, that get_stream_contets hooks the
script (even if it is working with fgets instead).


Reproduce code:
---------------
<?
pipe_spec = array(
                  0 => array("pipe", "r"),
                  1 => array("pipe", "w"),                                2 => 
array("file",
"ziperrors.txt", "a")
                 );

// using proc_open
$process = proc_open('zip', $pipe_spec, $pipes,'c:\');
// for some reason get_stream_contents also hangs anyway!
while (!feof($pipes[1])) // read results
  { print fgets($pipes[1]); }
fclose($pipes[1]);
proc_close($process);


// using system / exec (same results with both of them)

exec('dir'); // works fine
exec('zip'); // script hangs / deadload
print `zip`; // using backticks causes also deadload
?>

Expected result:
----------------
I expect to get any result / execute of the programs executed

Actual result:
--------------
actual results are...

1) exec or system call causes hookup / deadload of script
2.a) proc_open works, but wrong execution path, unable to change exec_path
using proc_open cwd-option
2.b) get_stream_contents also deadloads, needed to be replaced with fgets
to get nearly any result at all.

-- 
Edit bug report at http://bugs.php.net/?id=32888&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=32888&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=32888&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=32888&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=32888&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=32888&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=32888&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=32888&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=32888&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=32888&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=32888&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=32888&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=32888&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=32888&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=32888&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=32888&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=32888&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=32888&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=32888&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=32888&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=32888&r=mysqlcfg

Reply via email to