Edit report at http://bugs.php.net/bug.php?id=52073&edit=1

 ID:          52073
 Updated by:  ras...@php.net
 Reported by: php at richardneill dot org
 Summary:     RFE: a few more options to exec()
-Status:      Open
+Status:      Bogus
 Type:        Feature/Change Request
 Package:     Program Execution
 PHP Version: Irrelevant

 New Comment:

This is what proc_open() is for.


Previous Comments:
------------------------------------------------------------------------
[2010-06-13 02:48:15] php at richardneill dot org

Description:
------------
Exec() is missing a few key features:



1. The ability to return STDERR separately from STDOUT.



At the moment, we can get STDOUT back in $output, but STDERR is either

logged (for php-cgi) or sent to the main script STDERR (for php-cli). 

The user has the choice to append "2>&1", but it would be really
helpful

to have stderr and stdout both returned in separate arrays.



2. The ability to choose the shell. At the moment, exec() uses apache's
shell, 

which is usually /bin/sh  (either as bash or ash depending on distro).
If 

bash-isms are required, we can work around this with "bash -c '......
'", but 

it would be a nice feature.



3. If a process is forked, then we'd like to get the PID, $!. Currently


this can only be achieved thus:

  exec ("foo & echo $!", $output)

but we must sacrifice stdout for the purpose.



4. Optionally, some way to do execv("arg1", "arg2", "arg3"....)

Test script:
---------------
I'd suggest having a function:



exec( string $command 

      [, array &$stdout

      [,int &$retval 

      [,array &$stderr 

      [,int &$pid     

      [,int options = BASH|SH|CSH ] 

      ] ] ] ]

    ) 







------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=52073&edit=1

Reply via email to