phpseclib仅返回空白页面

时间:2016-02-07 09:58:19

标签: php shell phpseclib

我正在使用phpseclib通过ssh发送top -cbn1 | grep servers/Server_1 | head -n 1。该命令在终端窗口中按预期工作,但如果我用php执行它,则不返回任何内容。我的代码如下所示:

include('ssh/Net/SSH2.php');
include('../config/config.php');

$ServerID = 'Server_'.'1';

echo $ssh->exec('top -cbn1 | grep servers/Server_1 | head -n 1 \n');

1 个答案:

答案 0 :(得分:0)

There is a detailed instruction for your problem in the docs here:

phpseclib Documentation However since you limit the output to one entry i can't tell why it doesnt return anything but the docs might help you.