PHP ssh2_scp_send sometimes fails

I am using ssh2_scp_send to send one file from server1 to server2.

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

the command only returns one bool value telling if it was successful.

ssh2_scp_send

Where can I find a log message, or did any of you have one similar problem?

Thanks,
Pedro
@pedro

+2


source to share


3 answers


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

error_reporting(E_ALL);

      

You can also display errors in PHP output.



ini_set('display_errors', 1);

      

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

This can lead to more flexible error handling.

+1


source


PHP SSH2 is probably a wrapper around "libssh2" so if you are looking for logs check your syslog config file, if ssh protocol is not enabled then ssh logs activity to Apache log files. Logs are usually stored in / var / log

One good debugging method is to enable logging in php.ini



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

      

+1


source


ssh2_scp_send

doesn't work for me if the file is over 2 gigabytes it downloads 2 gigabytes and then stops.

0


source







All Articles