473,387 Members | 1,532 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Php Secure Shell2 (ssh2) Unable to request command execution onremote host

I have simple script:
<?php
$connection = ssh2_connect("ip", 22);
ssh2_auth_password($connection,"login","test");


sleep(10);
ssh2_exec($connection,"show log\n");


?>
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
Jul 5 '07 #1
6 9950
Varlamov Konstantyn kirjoitti:
Help me please....
Greetings,
Konstantyn Varlamov
You've asked now repeatedly several times the same thing. I'm sure that
if someone knows the answer, he or she will answer you, but for now
you'll just need to cool down and wait for a while. It doesn't help at
all that you keep asking the same thing over and over. The question is
here now and the people will try to help you with your trouble. Just
wait. If you feel you need to add something to the original question,
reply in one of the threads you've started, but please don't start any
new threads anymore. Patience is a virtue.

--
Ra*********@gmail.com

"Wikipedia on vähän niinq internetin raamattu, kukaan ei pohjimmiltaan
usko siihen ja kukaan ei tiedä mikä pitää paikkansa." -- z00ze
Jul 5 '07 #2
On 2007-07-05, Varlamov Konstantyn <ko**********@gmail.comwrote:
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

Jul 5 '07 #3
Rami Elomaa пишет:
Varlamov Konstantyn kirjoitti:
>Help me please....
Greetings,
Konstantyn Varlamov

You've asked now repeatedly several times the same thing. I'm sure that
if someone knows the answer, he or she will answer you, but for now
you'll just need to cool down and wait for a while. It doesn't help at
all that you keep asking the same thing over and over. The question is
here now and the people will try to help you with your trouble. Just
wait. If you feel you need to add something to the original question,
reply in one of the threads you've started, but please don't start any
new threads anymore. Patience is a virtue.
I am undrestend)I am waiting)
Jul 5 '07 #4
<?php
$connection = ssh2_connect("login", 22);

if (! $connection) {
die("Connection failed.");
}
else echo "connect OK";

if (! ssh2_auth_password($connection,"user","test")) {
die("Auth failed.");
}
else echo "login OK";
sleep(10);
$stream=ssh2_exec($connection,"show log\n");
stream_set_blocking($stream, true);
$output = stream_get_contents($stream);

?>

connect OKlogin OK
Warning: ssh2_exec(): Unable to request command execution on remote host
in /home/konstantyn/www/php/test.php5 on line 22

Warning: stream_set_blocking(): supplied argument is not a valid stream
resource in /home/konstantyn/www/php/test.php5 on line 25

Warning: stream_get_contents() expects parameter 1 to be resource,
boolean given in /home/konstantyn/www/php/test.php5 on line 26

Re:

The remote server is not a computer, it`s Dlink DES-3526 Ethernet Switch.
Command "show log" is valid comand for him.
Connection and login works but command executing triggers error.
Jul 5 '07 #5
Varlamov wrote:
$stream=ssh2_exec($connection,"show log\n");
Maybe newline is not wanted?

Jul 5 '07 #6
Tis is not work to
<?php
$connection = ssh2_connect("login", 22);

if (! $connection) {
die("Connection failed.");
}
else echo "connect OK";

if (! ssh2_auth_password($connection,"user","test")) {
die("Auth failed.");
}
else echo "login OK";
sleep(10);
$stream=ssh2_exec($connection,"show log");
stream_set_blocking($stream, true);
$output = stream_get_contents($stream);

?>

connect OKlogin OK
Warning: ssh2_exec(): Unable to request command execution on remote host
in /home/konstantyn/www/php/test.php5 on line 22

Warning: stream_set_blocking(): supplied argument is not a valid stream
resource in /home/konstantyn/www/php/test.php5 on line 25

Warning: stream_get_contents() expects parameter 1 to be resource,
boolean given in /home/konstantyn/www/php/test.php5 on line 26
Jul 6 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Janne Vuori | last post by:
I have Apache 2.0.54 and PHP 5.0.4 running on XP Professional. Everything is working ok but when I am tryin to add the extension php_ssh2.dll into use the PHP will generate an error message: PHP...
7
by: brian.vincent | last post by:
I'm trying to use the ssh2 functions to run a graphical app. I have no problem opening ssh2_shell and running something like "/bin/ls /tmp". However when I try to do something like:...
16
by: Serdar Kalaycý | last post by:
Hi everybody, My problem seems a bit clichè but I could not work around. Well I read lots of MSDN papers and discussions, but my problem is a bit different from them. When I tried to run the...
4
by: konsu | last post by:
hello, my client code communicates with a web service through a https connection. the code has a stub derived from SoapHttpClientProtocol. It also sets a certificate policy handler that allows...
0
by: bazzer | last post by:
hey, im trying to access a microsoft access database from an ASP.NET web application in visual basic 2003.NET. i get the following error when i try running it: Server Error in...
0
by: Holly | last post by:
I copied this code that works to connect into Unix. I am looking for a way to get it to work with a secure Unix box. Anyone have any insights on how to do this? I am trying to build an sftp...
2
by: Nemon | last post by:
I need to expose some scripting functionality to novice users in a project of mine. What i wonderd was if anyone knew a way of executing secure PHP from within a PHP script or an alternative...
0
by: Buddy Home | last post by:
Hello, I'm trying to upload a file programatically and occasionally I get the following error message. Unable to write data to the transport connection: An established connection was aborted...
3
by: Buddy Home | last post by:
Hello, I'm trying to upload a file programatically and occasionally I get the following error message. Unable to write data to the transport connection: An established connection was aborted...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.