ssh2 using Windows

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • adamsbarker

    ssh2 using Windows

    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($conn ection, '/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($conn ection, 'c:/php/php.exe c:/a.php');

    it doesn't seem to be working (the "a.php" file simply contains
    "file_put_conte nts('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_mkdi r($sftp, 'aaa');", it puts the directory "aaa" into that
    location - ie, i have to use "ssh2_sftp_mkdi r($sftp,
    '../../../../aaa');" to create the "aaa" directory at c:/aaa

    thanks,
    adam.

Working...