|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2007-07-02 18:39 UTC] ckeefer at us dot nomura dot com
Description:
------------
PHP CLI version 5.1.8 thru 5.2.1 Windows Binary - exec() function, when error is generated passes STDERR no problem to CLI window. 5.2.2+ STDERR output has vanished. Nothing in documentation or search suggests what happened. No other changes 5.2.1 just downloaded and tested with generic setup (no php.ini or other modifications) stderr from exec() functions perfectly. 5.2.2+ system() apparently passes stderr properly, but is not useful for most of what we do. STDOUT appears to be fine all versions.
Oddly, 5.2.2+ versions still work correctly with cygwin/bash 3.1
Note in 5.2.2 changelog contains this bit:
- Fixed commandline handling for CLI and CGI. (Marcus, Johannes)
Thanks,
Chip Keefer
Reproduce code:
---------------
<?php
$result = exec('cd c:\non_existant; dir nonexistant');
echo "$result\n";
?>
Expected result:
----------------
NJPC3916:php5.22$ php test_exec.php
php test_exec.php
The system cannot find the path specified.
- Works properly with cygwin
Actual result:
--------------
C:\php5.22>php test_exec.php
C:\php5.22>
No STDERR
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 11:00:02 2025 UTC |
Thank you for the quick response. The new version still shows no STDERR output from a cmd.exe window. Thanks C:\php5.2fix>php test_exec.php Two exec statements: ------------------- This exec should result in error for non-existant dir: Array ( ) ----------------------- This exec works: -------------------- Array ( [0] => Volume in drive C is LOCAL DISK [1] => Volume Serial Number is 4054-8345 [2] => [3] => Directory of C:\php5.2fix [4] => [5] => 07/03/2007 08:08 AM 32,821 php.exe [6] => 1 File(s) 32,821 bytes [7] => 0 Dir(s) 58,549,849,088 bytes free ) C:\php5.2fix> C:\php5.2fix>type test_exec.php <?php echo "Two exec statements:\n-------------------\n"; echo "This exec should result in error for non-existant dir:\n"; exec("cd c:\\non_existant", $err); print_r($err); echo "-----------------------\n"; echo "This exec works:\n--------------------\n"; exec("dir php.exe", $ary); print_r($ary); ?>