Connecting Tech Pros Worldwide Help | Site Map

ssh2 using Windows

  #1  
Old July 17th, 2005, 03:15 PM
adamsbarker
Guest
 
Posts: n/a
i'm using Windows to access an ssh server. everything works perfect
until i try executing files (ssh2_exec) and sending/receiving files
(ssh2_scp_send/ssh2_scp_recv)... in the function manual at php.net it
has the following example to execute a command:

ssh2_exec($connection, '/usr/local/bin/php -i');

i'm assuming this is for linux/unix machines, so on a Windows machine,
should it be possible to do the following?

ssh2_exec($connection, 'c:/php/php.exe c:/a.php');

it doesn't seem to be working (the "a.php" file simply contains
"file_put_contents('c:/bbbbb.txt','111');" and therefore doesn't create
"bbbbb.txt"), however, the 'c:/php/php.exe c:/a.php' command works
perfectly using a ssh client such as PuTTY.

also, with the send/receive functions, it comes up with errors. for
example, "ssh2_scp_recv($connection, 'c:/a.php', 'c:/aa.php');" comes
up with the error "Unable to receive remote file". when creating a
directory i have noticed that i must be beginning in the directory:
"c:/documents and settings/administrator/desktop", because when using
"ssh2_sftp_mkdir($sftp, 'aaa');", it puts the directory "aaa" into that
location - ie, i have to use "ssh2_sftp_mkdir($sftp,
'../../../../aaa');" to create the "aaa" directory at c:/aaa

thanks,
adam.

Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem using FTP in a unix shell script niteck07 answers 9 August 20th, 2007 07:14 PM
Telnet Response via PHP Sockets b00x answers 2 July 30th, 2006 04:05 PM
OS specific command in Python diffuser78@gmail.com answers 16 June 21st, 2006 11:55 PM
PHP calling programs on AS/400 Benny Hill answers 6 July 17th, 2005 12:12 PM