tags:

views:

188

answers:

2

Hi,

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

+1  A: 

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.

bucabay
What you all think, does the command have any concurrency restriction?
Pedro
Thanks for the help, I was not displaying the errors, after the ini_set(...) I was able to spot the problem. Cheers
Pedro
+1  A: 

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
Anand
I check the log of php and the syslog but nothing. Cheers
Pedro
have you checked apache logs?
Anand
Thank for your help! It was one good tip. Cheers
Pedro