1

PHP で SSH ストリームの出力を表示できません。これは私のコードです:

$output = ssh2_exec($sshCon, $sshCommand);

stream_set_blocking($output, true);

echo stream_get_contents($output);

出力は空白です。ただし、コマンドは確実に実行されています。ここに示す解決策も試しました: Empty PHP SSH2 stream contents, even with stream_set_blocking?

出力はプロセス ID である必要があります。

ありがとう!

4

1 に答える 1

1

純粋な PHP SSH 実装である phpseclib を試してください。

<?php
include('Net/SSH2.php');

$ssh = new Net_SSH2('www.domain.tld');
if (!$ssh->login('username', 'password')) {
    exit('Login Failed');
}

echo $ssh->exec($sshCommand);
?>
于 2012-06-17T20:41:41.633 に答える