Pedro
Pedro

Reputation: 2927

PHP ssh2_scp_send sometimes fails

I'm using ssh2_scp_send to send one file from server1 to server2.

It works almost 80% of the times, but sometimes fails and I can't find any log message and i don't know why!

the command only return one bool value saying if it was sucessfull.

ssh2_scp_send

Where can I find some log message or any of you had one similar problem?

Thanks,
Pedro
@pedro

Upvotes: 2

Views: 3466

Answers (3)

Bento
Bento

Reputation: 1

ssh2_scp_send fails for me if the file size is more then 2 GiB, it uploads 2 GiB and then stops.

Upvotes: 0

Anand Shah
Anand Shah

Reputation: 14913

PHP SSH2 is a probably a wrapper around the "libssh2", so if you are looking for logs then check your syslog config file, if ssh logging is not enabled in there then ssh logs the activity in apache log files. Logs are generally stored in /var/log

One good debugging technique would be to enable logging in php.ini

log_errors = On
error_log = /path/to/logfile.log

Upvotes: 1

bucabay
bucabay

Reputation: 5295

The path to the PHP error log is defined with "error_log" in PHP.ini. In your PHP script you should display all errors during development.

error_reporting(E_ALL);

You can also choose to show errors in the PHP output.

ini_set('display_errors', 1);

There is an alternative shown on: http://php.oregonstate.edu/manual/en/function.ssh2-scp-send.php#82927

That may give you more flexible error handling.

Upvotes: 1

Related Questions