Answer the question
In order to leave comments, you need to log in
How to send commands from under PHP via ssh and get a response?
Good time of the day,
I try to send a string from under php via ssh and get a response
, but there is silence in response, I hope that someone will tell you
$connection = ssh2_connect('localhost', 22);
ssh2_auth_password($connection, 'root', '0000000');
$stream = ssh2_exec($connection, 'top');
stream_set_blocking($stream, true);
$stream_out = ssh2_fetch_stream($stream, SSH2_STREAM_STDIO);
print_r( stream_get_contents($stream_out));
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question