ID:               22662
 Comment by:       bmcclory at gmail dot com
 Reported By:      pjaleysen at hotmail dot com
 Status:           Open
 Bug Type:         Feature/Change Request
 Operating System: Windows XP
 PHP Version:      4.3.2-RC
 New Comment:

Can someone tell me why the following code will not work in Windows:

system("nmap $host");

Driving me nuts.  It works fine on apache servers and apparantly other
IIS servers.  I don't know if i'm missing something in php.ini or what. 
Other commands can be run from system(), just not nmap.


Previous Comments:
------------------------------------------------------------------------

[2004-08-03 05:57:51] wfrench at prevailnet dot net

I've had the same problem trying to use unzip.exe on XP with php
4.3.8.

Got some interesting results when I tried the dos batch file wrapper
approach...

When I use the batch:
-----------------------------
@echo hello world
-----------------------------

it works like a champ.

but when I change the file thusly:
-----------------------------
unzip
@echo hello world
-----------------------------

if prints the following:
---------------------------------
c:\inetpub\wwwroot\svgwork>unzip hello world 
---------------------------------

Obviously it has prepended my command (unzip) with my web directory. 
Not so obvious perhaps is what the '>' character is doing in there.

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

[2004-04-28 20:00:19] clubland at gmx dot net

Hi all,

Platform:
IIS 6.0 / Windows 2003 Server

Problem:
shell_exec etc `s not working

Solution:
check rights on %SYS32%\cmd.exe

Chris

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

[2003-06-03 17:52:16] spoon at nexdot dot net

This seems very close to what im experiencing.

I am using php 5.0.0-dev (updated about 2 weeks ago), but the problem
has occured for me on 4.x.x versions. I use Windows XP Pro/Windows 2000
Server with my 5.0.0-dev. Apache 2 24

When i use ANY of the MANY methods for passing a system call

System
Shell_exec
Exec
``  (backtick)
Passthru

they all act the same (in this case, as a passthru), UNLESS with a
native dos command (which i tried after reading this bug post).

The functions such as the 2 exec ones and the backticks should not
output anything. I do this:

$string=exec/shell_exec/``;

when calling something such as ping/dir/echo, or any normal dos
command, they work as expected... nothing is output to the browser (or
above the php header have you) unless i do an

echo $string;

When i try to call a program such as gzip, $string has a length of 0
(or null) and the the output from the command appears in my browser (or
above PHP headers if run from command line) without echo'ing. Other
special parts of each system call functions also do not work, such as
exec's array output, which is null unless a native dos command.

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

[2003-03-15 03:42:47] pjaleysen at hotmail dot com

Executing Windows-based applications work alright, but not the ones
running in DOS. e.g. I am using winzip now instead of pkzip.exe for dos.


Because I have to use windows application, it will mke the php code
less portable, since I have to use installed software

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

[2003-03-13 06:33:40] pjaleysen at hotmail dot com

Nope, paths, all of that excluded.I tried to put some details below,
comming from http://forums.devshed.com/t55038/s.html (which also deals
with the various path issues. Many others also had a look at it).

At the very end of the forum there is an assumption that it is a WinXP
problem, since win2000 works fine.

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

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
    http://bugs.php.net/22662

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

Reply via email to