Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当我们使用时ssh2_connect,会创建 ssh 会话。完成所有工作后,我做
ssh2_connect
ssh2_exec($con, 'exit;'); unset($con);
这是一个连续的过程(通过代码建立和关闭 ssh 连接)。2/3 天后,我发现,进一步的 ssh 会话(甚至从终端手动尝试)被拒绝。因此,SSH 会话更有可能没有被正确终止。
请指导我如何以简洁干净的方式退出 PHP 会话,以免 ssh2_connect 将来失败。
$blah=ssh2_exec($con, 'exit;'); .... fclose($blah);