From:
Operating system:
PHP version: Irrelevant
Package: Program Execution
Bug Type: Feature/Change Request
Bug description:RFE: a few more options to exec()
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 bug report at http://bugs.php.net/bug.php?id=52073&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=52073&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=52073&r=trysnapshot53
Try a snapshot (trunk):
http://bugs.php.net/fix.php?id=52073&r=trysnapshottrunk
Fixed in SVN:
http://bugs.php.net/fix.php?id=52073&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=52073&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=52073&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=52073&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=52073&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=52073&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=52073&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=52073&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=52073&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=52073&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=52073&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=52073&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=52073&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=52073&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=52073&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=52073&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=52073&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=52073&r=mysqlcfg