Re: Hoping for a working example of SFTP in PHP
| From: | David Spector | Date: | Sun, 07 Feb 2021 12:56:01 +0000 |
| Subject: | Re: Hoping for a working example of SFTP in PHP | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-327469@lists.php.net to get a copy of this message | ||
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