Edit report at https://bugs.php.net/bug.php?id=63567&edit=1
ID: 63567
Updated by: pajoye@php.net
Reported by: seld@php.net
Summary: exec() always yields a 1 return code
-Status: Feedback
+Status: Not a bug
Type: Bug
Package: Program Execution
Operating System: Windows 7 x64
PHP Version: 5.5.0alpha1
Block user comment: N
Private report: N
New Comment:
Not a php issue
Previous Comments:
------------------------------------------------------------------------
[2012-11-28 12:01:30] circus2 at web dot de
Problem solved! I'm so sorry about all these inconveniences and on the other
side thank you for your support.
The problem was a small tool called Ansicon it hooks on the autoload of cmd.exe
in the windows registry. I used it a couple of months ago but uninstalled it
immediately. It seem to have no effect by this time but it looks now like the
uninstall procedure doesn't care about the windows registry keys it has made
when installed.
So I deleted these keys and now everything is fine. No syntax error and status
code is 0. \o/
Thank you
------------------------------------------------------------------------
[2012-11-28 07:55:23] circus2 at web dot de
1. I use PHP 5.4.9, VC9, x86, TS from http://windows.php.net
2. Win7 SP1 Home Premium 64 Bit
------------------------------------------------------------------------
[2012-11-27 16:55:45] pajoye@php.net
Arg, misread.
So dir has the same issue.
Please tell me again:
- which PHP version you use (5.4.9 f.e.)
- exact windows version (check "My computer" > system)
------------------------------------------------------------------------
[2012-11-27 15:53:20] pajoye@php.net
To me it looks like a git issue. Which git version and build do you use?
------------------------------------------------------------------------
[2012-11-27 15:03:27] circus2 at web dot de
Ok.
I have a file called test.php:
<?php
exec('dir', $out, $ret);
var_dump($ret);
when I execute with PHP I get the following output:
C:\Test>php -n test.php
Die Syntax für den Dateinamen, Verzeichnisnamen oder die Datenträgerbezeichnung
ist falsch.
int(1)
when I execute it directly in the shell I get:
C:\Test>php -r "exec('dir', $out, $ret);var_dump($ret);"
Die Syntax für den Dateinamen, Verzeichnisnamen oder die Datenträgerbezeichnung
ist falsch.
int(1)
when I use the commands without PHP I get:
C:\Test>dir
Datenträger in Laufwerk C: ist ACER
Volumeseriennummer: xxxxx
Verzeichnis von C:\Test
27.11.2012 15:54 <DIR> .
27.11.2012 15:54 <DIR> ..
27.11.2012 15:56 47 test.php
1 Datei(en), 47 Bytes
2 Verzeichnis(se), 171.682.844.672 Bytes frei
C:\Test>echo %errorlevel%
0
The commands are executed in every case. So I can add var_dump($out); to
test.php and get:
C:\Test>php -n test.php
Die Syntax für den Dateinamen, Verzeichnisnamen oder die Datenträgerbezeichnung
ist falsch.
array(10) {
[0]=>
string(36) " Datenträger in Laufwerk C: ist ACER"
[1]=>
string(30) " Volumeseriennummer: xxxxx"
[2]=>
string(0) ""
[3]=>
string(24) " Verzeichnis von C:\Test"
[4]=>
string(0) ""
[5]=>
string(37) "27.11.2012 16:01 <DIR> ."
[6]=>
string(38) "27.11.2012 16:01 <DIR> .."
[7]=>
string(44) "27.11.2012 16:01 63 test.php"
[8]=>
string(48) " 1 Datei(en), 63 Bytes"
[9]=>
string(60) " 2 Verzeichnis(se), 171.683.024.896 Bytes frei"
}
int(1)
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=63567--
Edit this bug report at https://bugs.php.net/bug.php?id=63567&edit=1