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

Posted by Lowell Allen on 06/20/05 19:03

On Jun 20, 2005, at 11:19 AM, JB05UK wrote:

> 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.

Substituting "wb" for "wt" also fails. As I said in my OP below, I need
to send both text files and binary files, and the remote server will be
Windows (although I'm now testing on Linux), so that's why I have the
"t" flag, but you're probably right to suggest just using "b" in all
cases.

Thanks for your reply.

--
Lowell Allen

>
> 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
>

 

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

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