You are here: Re: SFTP problems « PHP « IT news, forums, messages
Re: SFTP problems

Posted by JB05UK on 06/20/05 18:19

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация