我正在运行一个使用ssh2_exec的命令,但看起来像是在$ stream1进程结束之前运行$ stream2。如何在$ stream1结束后才运行$ stream2?ssh2_exec:等待下一次运行的进程结束
<?php
$connection = ssh2_connect('shell.example.com', 22);
ssh2_auth_password($connection, 'username', 'password');
$stream1= ssh2_exec($connection, 'command to run');
$stream2 = ssh2_exec($connection, 'command to run 2');
?>
现在它给了我一个错误的$ stream2线。 PHP警告:ssh2_exec():无法从第28行的XXX.php中的远程主机请求一个频道 – user3780518
当我使用stream_get_contents删除该行时,我得不到任何错误。 – user3780518
对不起,我对ssh2扩展并不熟悉,不知道为什么会发生这种情况,或者如何解决它。 – Barmar