-1

I am using the phpseclib library for files downloaded from SFTP server. Sometimes the script does not download the file even there is a file in SFTP. Sometimes the file will download when we refresh a couple of times.

How can I reconnect automatically when the connection is lost?

Or

How to increase the active session time.

Bharanikumar
  • 25,457
  • 50
  • 131
  • 201
  • You should go into more detail about how you are making your calls. Code examples help for instance (sanitized of course). It is difficult to tell exactly what you are looking to do, since reconnect is vague. – Guvante Dec 07 '12 at 22:50

1 Answers1

1

I guess you could put the code in a while loop. eg. while (action_not_done) { $sftp = new Net_SFTP(); ... }

If it's timing out... could be that your timeout is set pretty low for what you're trying to do. A PHP timeout of 10 seconds for downloading a 10GB file might not be enough.

If it's not something like that then posting logs would help. Here's an example of how to get them:

http://phpseclib.sourceforge.net/sftp/examples.html#logging

neubert
  • 15,947
  • 24
  • 120
  • 212