note 51986 added to function.ssh2-sftp
| From: | daveywalbeck at yahoo dot com | Date: | Mon, 18 Apr 2005 02:56:08 +0000 |
| Subject: | note 51986 added to function.ssh2-sftp | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-88140@lists.php.net to get a copy of this message | ||
I think it's worth mentioning that if you plan to use the 'fopen' command to write to
a remote file, the example provided failed consistantly using the syntax given, as well as the
second method.
ssh2.sftp://$sftp/example.com/path/to/file
ssh2.sftp://user:pass@$sftp/example.com/path/to/file
It's just a small adjustment to correct this, but as most coding goes, a long road to find a
stupid little oversight. Apparently it is necessary to supply the port as well in the path. Could
just be the few systems I was testing against, but that would be three separate networks using three
separate platforms (Windows Server, Linux, Unix). At any rate, the following works like a charm,
and was very simple to install the libssh2 library and PECL SSH2 module required to use this system.
Gotta love PHP.
ssh2.sftp://$sftp/example.com:22/path/to/file
ssh2.sftp://user:pass@$sftp:22/example.com/path/to/file
Hope this saves anyone some headache and time.
----
Manual Page -- http://www.php.net/manual/en/function.ssh2-sftp.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+51986
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+51986&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+51986&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+51986&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+51986&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+51986&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+51986&report=yes
Search -- http://master.php.net/manage/user-notes.php