PHP没有读取psexec输出

时间:2014-10-14 01:40:04

标签: php psexec

问题很简单。在浏览器和命令行中运行一个php文件产生了截然不同的结果,我不能为我的生活找出原因。以前有没有php / psexec专家遇到过这个?

<?php

echo '<pre>';
$output = shell_exec("psexec -accepteula \\\mypcname -u mypcname\\accountname -p xxxxxxx ipconfig /all 2>&1");
var_dump($output);
echo '</pre>';

在浏览器窗口中生成此输出...

string(350) "
PsExec v2.11 - Execute processes remotely
Copyright (C) 2001-2014 Mark Russinovich
Sysinternals - www.sysinternals.com


Windows IP Configuration

Connecting to admin-pc...


Starting PSEXESVC service on admin-pc...


Connecting with PsExec service on admin-pc...


Starting ipconfig on admin-pc...


ipconfig exited on admin-pc with error code 0.  

而不是这个,这是我通过命令行运行相同的php文件时得到的输出。

C:\MAMP\bin\php\php5.5.12>php-cgi c:\mamp\htdocs\go.php
X-Powered-By: PHP/5.5.12
Content-type: text/html

hi<pre>string(5113) "
PsExec v2.11 - Execute processes remotely
Copyright (C) 2001-2014 Mark Russinovich
Sysinternals - www.sysinternals.com


Windows IP Configuration

   Host Name . . . . . . . . . . . . : mypcname
   Primary Dns Suffix  . . . . . . . :
   Node Type . . . . . . . . . . . . : Hybrid
   IP Routing Enabled. . . . . . . . : No
   WINS Proxy Enabled. . . . . . . . : No
   DNS Suffix Search List. . . . . . : home

Ethernet adapter Local Area Connection:

   Connection-specific DNS Suffix  . : home
   Description . . . . . . . . . . . : Intel(R) 82567LM-2 Gigabit Network Connec
   tion
   Physical Address. . . . . . . . . : xx-xx-xx-xx-xx-xx
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes
   IPv4 Address. . . . . . . . . . . : 192.168.1.4(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Lease Obtained. . . . . . . . . . : Thursday, October 09, 2014 4:36:43 PM
   Lease Expires . . . . . . . . . . : Tuesday, October 14, 2014 4:16:04 PM
   Default Gateway . . . . . . . . . : 192.168.1.1
   DHCP Server . . . . . . . . . . . : 192.168.1.1

   DNS Servers . . . . . . . . . . . : 8.8.8.8
                                       8.8.4.4
   NetBIOS over Tcpip. . . . . . . . : Enabled
"
</pre>
C:\MAMP\bin\php\php5.5.12>

0 个答案:

没有答案