David,
After debugging most of the day with very unhelpful messages from
windows. I decided to run it on linux which pointed me to this bug
https://bugs.php.net/bug.php?id=79631. ; It turns out that it is copying
the file successfully, but PHP segfaults which causes apache to return a
408 Request Timeout. It seemed to work in the command line because
apache wasn't throwing errors.
The answer is, to change -
unset($sftp);
to
ssh2_disconnect($sftp);
I haven't programmed many extensions, but I believe there is a way to
tell which SAPI it is running on (cli, apache, fpm, debug, etc.). That
is why my head went there.
Anyway I will update the gists that I wrote to reflect this. change.
Eric
On 2/6/21 9:24 AM, David Spector wrote:
Eric, Answers:
I use Apache 2.4 both locally and remotely, I believe.
Installed on Windows as a component of Bitnami WAMP, a standard stack
product.
If it has something to do with the server, it would most likely be an
incorrect directive in httpd.config, the file that configures Apache.
I can't imagine what it could be.
Yes, your other method did work, the first time I tried it. Only the
"copy" command is not working. The system is failing to generate a
meaningful error message to help us debug the problem. I'm guessing
that file-exists with a wrapper is succeeding, as it did with your
previous program. So only copy is failing, which narrows it a bit.
I can't see how Apache could disable a PHP stream, but anything is
possible. I don't know what fpm is; I probably don't use it.
Does my program work or fail for you as-is when you insert your
parameters? If it fails, you can try to debug it. If it succeeds,
perhaps we are stuck.
David