I need to use SFTP to send text files and binary files from one server to another, but I'm unable to use fopen on the remote server, and if I send with ssh2_scp_send the files are truncated. I'm assuming the libssh2-PECL/ssh2 installation isn't the problem because I'm able to connect using ssh2_auth_password, create a directory on the remote server with ssh2_sftp_mkdir, and copy files with ssh2_sftp_send and ssh2_sftp_recv (even though ssh2_sftp_send truncates files).

When I try to use fopen, I get this error message:

Warning: fopen(): Unable to open ssh2.sftp://Resource id #10/whatever.com:22/home/whatever/public_html/flamingo/test.txt on remote host in /home/user/public_html/cms/sftp_test.php on line 79

Warning: fopen(ssh2.sftp://Resource id #10/whatever.com:22/home/whatever/public_html/flamingo/test.txt): failed to open stream: Resource temporarily unavailable in /home/user/public_html/cms/sftp_test.php on line 79

Here's line 79 of sftp_test.php:

$stream = fopen("ssh2.sftp://$sftp/whatever.com:22/home/whatever/public_html/ flamingo/".$filename, "wt")

I've read "Secure Communications with PHP and SSH" in the February PHP Architect. That's what prompted me to try PECL/ssh2, but now I'm stuck. Anybody successfully using fopen with SFTP or anybody using ssh2_sftp_send without getting truncated files?

--
Lowell Allen

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to