// get connection $conn = ssh2_connect($host, $port); // login via pub-private keys ssh2_auth_pubkey_file($conn, $username, $publicKey, $privateKey); // run command via ssh2 $stream = ssh2_exec($conn, 'php -v'); stream_set_blocking($stream, true); $stream_out = ssh2_fetch_stream($stream, SSH2_STREAM_STDIO); // get the output echo stream_get_contents($stream_out);This is simply for my personal note for future reference, but hopefully it can also help who might be looking for solutions for this.
hello thanks for the codes i just tried and its taking a lot of time to execute what could be the problem?
Thanks for visiting my blog and post questions.
Have you tried to echo out messages at each step to confirm which step took time? There are three steps I can see: