How To Get Error Message From PHPSECLIB $sftp->put
Asked Answered
S

1

10

I am using PHPseclib to transfer a file from a local fileserver to a remote fileserver. I am able to connect to the server, have 0777 permission on the target file on my local fileserver, but $sftp->put is failing. Right now it return bool, but is there a way I can extract the actual error message or at least an error code?

I have tried $sftp->error, but that value is null. I am running PHP5.1 (can't upgrade to latest version b/c it is not actually my server).


SOLUTION:

Using $sftp->getSFTPErrors() return an array with sftp errors.

Siddur answered 11/12, 2012 at 17:44 Comment(0)
V
10

You could try $ssh->getErrors(), which'll return an error. You could also do $ssh->getSFTPErrors().

Failing that the logs might provide some insight but let's see what the errors get you first.

Vestiary answered 11/12, 2012 at 17:59 Comment(1)
Thanks, neubert. $sftp->getSFTPErrors() worked beautifully. Incidentally, $ssh->getErrors() returns an empty array.Siddur

© 2022 - 2024 — McMap. All rights reserved.