Re: SFTP problems

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Read the php man, it says to use the 'b' flag for binary files, infact it says to use it most the time anyway, if im not mistaken.



Lowell Allen wrote:
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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux