You are here: Re: Php Secure Shell2 (ssh2) Unable to request command execution on remote host « PHP Programming Language « IT news, forums, messages
Re: Php Secure Shell2 (ssh2) Unable to request command execution on remote host

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация