473,378 Members | 1,066 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,378 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 9947
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: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.