Re: Hoping for a working example of SFTP in PHP

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

 



LogLevel DEBUG should be set on the remote ssh server config.

So, The connection doesn't seem to be the problem.  I replicated this error message by switching the param order of the copy function.  It looks like the param order got switched some how.

You can see the error is in the first parameter of the copy function.  It is getting the sftp:// stream url and not the local file.

On 2/7/21 4:56 AM, David Spector wrote:
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



[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