473,796 Members | 2,483 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

I have simple script:
<?php
$connection = ssh2_connect("i p", 22);
ssh2_auth_passw ord($connection ,"login","test" );


sleep(10);
ssh2_exec($conn ection,"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 10004
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*********@gma il.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**********@g mail.comwrote:
I have simple script:
<?php
$connection = ssh2_connect("i p", 22);
Here, you can check $connection, as in:
if (! $connection) {
die("Connection failed.");
}
ssh2_auth_passw ord($connection ,"login","test" );
Here, you can check if the auth succeeded, as in:
if (! ssh2_auth_passw ord($connection ,"login","test" )) {
die("Auth failed.");
}
sleep(10);
ssh2_exec($conn ection,"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($conn ection, ...);
and then I think you might trying examining $stream:
stream_set_bloc king($stream, true);
$output = stream_get_cont ents($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("l ogin", 22);

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

if (! ssh2_auth_passw ord($connection ,"user","test") ) {
die("Auth failed.");
}
else echo "login OK";
sleep(10);
$stream=ssh2_ex ec($connection, "show log\n");
stream_set_bloc king($stream, true);
$output = stream_get_cont ents($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_bloc king(): supplied argument is not a valid stream
resource in /home/konstantyn/www/php/test.php5 on line 25

Warning: stream_get_cont ents() 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_ex ec($connection, "show log\n");
Maybe newline is not wanted?

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

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

if (! ssh2_auth_passw ord($connection ,"user","test") ) {
die("Auth failed.");
}
else echo "login OK";
sleep(10);
$stream=ssh2_ex ec($connection, "show log");
stream_set_bloc king($stream, true);
$output = stream_get_cont ents($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_bloc king(): supplied argument is not a valid stream
resource in /home/konstantyn/www/php/test.php5 on line 25

Warning: stream_get_cont ents() 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
4729
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 Warning: PHP Startup: Unable to load dynamic library 'c:/php5/ext/php_ssh2.dll' - The specified module could not be found.\r\n in Unknown on line 0 ON httpd.conf I have LoadModule php5_module "c:/php5/php5apache2.dll" AddType...
7
3332
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: fwrite($stdio,"/usr/X11R6/bin/xclock -display some-other-machine:0\n"); It doesn't work. I've tried wrapping the xclock command in a shell script and a C program and still no luck. In both instances I can ssh into the remote machine and run the commands...
16
4226
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 project in debug mode (by hitting F5) it gives an error message "Error while trying to run project: Unable to start debugging on the web server.
4
15490
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 everything: class CertificatePolicy : ICertificatePolicy { public bool CheckValidationResult(ServicePoint servicepoint, X509Certificate certificate, WebRequest request, int problem) { return
0
12069
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 '/CinemaBookingSystem' Application. -------------------------------------------------------------------------------- ERROR General error Unable to open registry key 'Temporary (volatile) Jet DSN for process
0
1487
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 service. Thanks Holly Imports System Imports System.Net Imports System.IO
2
1595
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 embedded scripting method? Some interaction between the PHP script host and the secure embedded script are needed. I'm currently i'm playing with ASP.NET(C#) and embeded jscript(spidermonkey) via managed C++ library but it's quite alot of work,...
0
789
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 by the software in your host machine. Stack Trace at System.Net.Sockets.NetworkStream.Write(Byte buffer, Int32 offset, Int32
3
14059
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 by the software in your host machine. Stack Trace at System.Net.Sockets.NetworkStream.Write(Byte buffer, Int32 offset, Int32
0
10228
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10173
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10006
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7547
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5441
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5573
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4116
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3731
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2925
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.