|
Posted by Charles Polisher on 07/05/07 19:39
On 2007-07-05, Varlamov Konstantyn <konstantyn17@gmail.com> wrote:
> I have simple script:
><?php
>
>
> $connection = ssh2_connect("ip", 22);
Here, you can check $connection, as in:
if (! $connection) {
die("Connection failed.");
}
> ssh2_auth_password($connection,"login","test");
Here, you can check if the auth succeeded, as in:
if (! ssh2_auth_password($connection,"login","test")) {
die("Auth failed.");
}
> sleep(10);
>
>
> ssh2_exec($connection,"show log\n");
Is "show log" a valid command? I think this
is what may be messing you up. Try something simple
like "/bin/ls", also you want to set a variable
as in:
$stream = ssh_2exec($connection, ...);
and then I think you might trying examining $stream:
stream_set_blocking($stream, true);
$output = stream_get_contents($stream);
> ?>
> Error message:
> Unable to request command execution on remote host in
> /home/konstantyn/www/php/test/11.php5 on line 13
>
> Help me please....
> Greetings,
> Konstantyn Varlamov
Hope this helps a little,
Charles
Navigation:
[Reply to this message]
|