AFTNHombre Posted November 30, 2011 Share Posted November 30, 2011 I have this problem where I make an ssh2 connection in this class, use it several times, and then it breaks, as in, further calls that use that resource fail. What happens is I make several ssh2_scp_recv() calls, then I call: $stream = ssh2_exec(EX_SFTP::$connection, "date --utc -r conf/au.conf '+%Y-%m-%d %H:%M:%S'; echo __COMMAND_FINISHED__"); That succeeds, then $stream is read, and the command is determined to be finished when "__COMMAND_FINISHED__" is parsed. (The only thing done w/$stream is that it is passed to fread() and strlen(). It isn't closed, or anything) Now the next thing I do is call ssh2_scp_send(), which results in an exception whose message is "ssh2_scp_send(): Failure creating remote file". The reason I think the connection somehow wore out is that a boorish solution I tried was to reconnect to the server every time I use EX_SFTP::$connection. So only using fresh connections is an answer, but I can do better than that. Unfortunately, I don't know of any reliable way to test the health of a connection. Link to comment https://forums.phpfreaks.com/topic/252144-is-it-possible-to-wear-out-an-ssh2-connection/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.