Re: Hoping for a working example of SFTP in PHP

[email protected] (David Spector)
Newsgroups php.general
Message-ID <[email protected]>
Dear Eric,

Earlier you stated that the file was uploaded, but a fault occurred 
afterward.

So I checked carefully, and the file is not uploaded by 'copy', either 
to the document root or to the public_html directory on the remote server.

As to changing set_time_limit, that will not fix an infinite loop. A 
file copy operation should complete in 15 seconds or less, and the 
browser timeout is a minute or more.

As for setting LogLevel to DEBUG, I'm unsure whether you are referring 
to the local or remote webserver, and to Apache or PHP.

As to using fopen, I changed the program to:

$handle=fopen($streamURL,'rw');
exit;

and it still does its infinite loop thing at the fopen function.

I notice that you did lots of special error handling stuff, so I tried 
to use an undefined variable in a context that requires a defined 
variable, and the result was an infinite loop.

So I commented out your error handler.

Then I got the error message for my undefined variable.

I uncommented your 'copy' code and got the error message that has been 
causing the infinite loop:

"Warning: copy(ssh2.sftp//6/home/nsr/public_html/test.txt): failed to 
open stream: No such file or directory in 
C:\Dropbox\Private\Web\nsr-HMAC\upload\Wheeler-2.php on line 67
Failed to copy local file 
'C:\Dropbox\Private\Web\nsr-HMAC\upload\test.txt' to remote file 
'ssh2.sftp//6/home/nsr/public_html/test.txt' "

I don't know how to debug this, but at least it's not an infinite loop.

David
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.