運行在PHP 5.2.13這工作得很好:phpseclib - 用php版本問題
輸出的每一行顯示..
include('includes/Net/SSH2.php');
$ssh = new Net_SSH2('127.0.0.1');
if (!$ssh->login('root', 'password')) {
exit('Login Failed');
}
function packet_handler($str)
{
echo $str;
}
$ssh->exec('ping 127.0.0.1', 'packet_handler');
運行於PHP 5.3.17返回任何內容相同的代碼。
我不得不使用像
echo $ssh->exec('timeout 5 ping 127.0.0.1');
,並等待它超時。
任何想法爲什麼這不適用於新版本?
謝謝
PHP 5.2和5.3有很多不同之處。嘗試添加'error_reporting(E_ALL); ini_set('display_errors','1');'進入腳本的開頭,它會顯示錯誤。 – stepozer
謝謝 - 我已經添加了,並重新運行它只是繼續運行的腳本 - 沒有錯誤等顯示在屏幕上或在error_log! – Rocket
您使用的是什麼版本的Net_SSH2? – stepozer