php使用ssh2通过账密连接服务器失败
问题描述:
php直接通过ssh2拓展链接服务器,结果发生了catch
//建立ssh2连接
$ssh2 = ssh2_connect($public_ip, 22);
if (!$ssh2) {
Log::error('连接服务器失败');
//重新建立ssh2连接
sleep(10);
$ssh2 = ssh2_connect($public_ip, 22);
if (!$ssh2) {
Log::error('再次连接服务器失败');
return;
}
}
Log::in[......]