cronを用いて以下test.phpを実行し、SSHのコマンドを実行しようとしています。
test.phpの中身
<?php include __DIR__.'/Net/SSH2.php'; $ssh = new Net_SSH2('サーバーアドレス'); if (!$ssh->login('ユーザー名', 'パスワード')) { exit('ログイン失敗'); } echo $ssh->exec('コマンド'); ?>
この時、ブラウザのアドレスバーにURLを入力してtest.phpを実行するとコマンドは実行されるのに、cronで実行させると、以下のようなエラーが出て動きません。
PHP Notice: No compatible server to client encryption algorithms found in /home/test.jp/public_html/Net/SSH2.php on line 1561
パーミッションは755に設定しています。
一体何が原因で動かないのでしょうか?
同じファイルを参照しているはずなのに、ブラウザとcronで実行結果が変わるということは有りうるのでしょうか?
追記.
1561行目付近のコードは以下になります(1561は「user_error('No comp…」)。
// we need to decide upon the symmetric encryption algorithms before we do the diffie-hellman key exchange // we don't initialize any crypto-objects, yet - we do that, later. for now, we need the lengths to make the // diffie-hellman key exchange as fast as possible $decrypt = $this->_array_intersect_first($encryption_algorithms, $this->encryption_algorithms_server_to_client); $decryptKeyLength = $this->_encryption_algorithm_to_key_size($decrypt); if ($decryptKeyLength === null) { user_error('No compatible server to client encryption algorithms found'); return $this->_disconnect(NET_SSH2_DISCONNECT_KEY_EXCHANGE_FAILED); }
なんの事かさっぱり分かりません。。。
回答2件
あなたの回答
tips
プレビュー