I am running a command using ssh2_exec, but looks like it runs the $stream2 before the end of $stream1 process. How do I run $stream2 only after the end of $stream1?
<?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');
?>