note 51987 added to function.fopen
| From: | php-general at lists dot php dot net | Date: | Mon, 18 Apr 2005 03:41:57 +0000 |
| Subject: | note 51987 added to function.fopen | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-88141@lists.php.net to get a copy of this message | ||
This only relavant to those opening a remote file for writing using the PECL SSH2 for SFTP paths for
the string filename. Since SFTP has variations, most of which are non-secure, using this module is
the only viable solution. The optional FTP extension class that uses the function
'ftp_ssl_connect' uses openssl, which only encrypts the communication requests and not the
data - or something close to that. At any rate, many systems will not allow connection to their
SFTP server using this method.
I think it's worth mentioning that some of the examples provided in various areas failed
consistantly using the syntax given, using both possible methods of.
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.fopen.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+51987
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+51987&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+51987&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+51987&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+51987&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+51987&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+51987&report=yes
Search -- http://master.php.net/manage/user-notes.php