shell_exec将不会显示所有输出。我的代码基本上运行psexec来捕获来自其他服务器的数据。该命令在CMD上运行正常。但在PHP中,仅缺少部分输出。我确实得到了PSEXEC标头消息和一些输出
已经使用SYSDBA
了,但我仍然没有得到想要的输出,但是我确实得到了过程
2>&1
我希望输出将是(在同一服务器上的CMD上运行)
$cmd = "psexec \\server1 omnistat -previous -since {$before} -until {$now}";
$output = shell_exec($cmd);
但我只能在网络浏览器视图中找到它:源
PsExec v2.2 - Execute processes remotely
Copyright (C) 2001-2016 Mark Russinovich
Sysinternals - www.sysinternals.com
Session ID Type Status User.Group@Host
===============================================================================
2019/08/12-1 Backup Completed xxx
2019/08/12-2 Backup Completed xxx
2019/08/12-3 Backup Aborted xxx
2019/08/13-1 Media Completed xxx
--hundreds of lines below
即使使用PsExec v2.2 - Execute processes remotely
Copyright (C) 2001-2016 Mark Russinovich
Sysinternals - www.sysinternals.com
Session ID Type Status User.Group@Host
===============================================================================
,我也只会收到命令成功运行的消息