SSH2, Reading Streams and Timing Out

From: Date: Mon, 18 Apr 2005 02:42:47 +0000
Subject: SSH2, Reading Streams and Timing Out
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-213248@lists.php.net to get a copy of this message
I have a system that is using PHP to SSH(2) and administrate remote systems. It is set up to both sftp and run commands. The trouble I am having is that it has been very unreliable. While it always connects without trouble, it will often hang while reading or writing to a stream. (When executing a command you are returned a stream that is then read to retrieve your response). When it hangs and times out I am not getting an error. I have placed flush commands all over the place (output buffering is off), so I get a partial view but no ending error telling me what went wrong (errors are on). To add to my confusion, this does not always happen. Sometimes it responds quickly, fully and successfully. Sometimes it will hang for a long time and fail with no error message. Sometimes it will respond quickly and fail with no message. I have socket_set_blocking to false on streams coming off the remote server. I am reading and writing in 5120 blocks. I have tried setting up time outs on the streams to have my system error out before php does, but that does not seem to be fully working. Sorry if this message is not so clear. I am actually hoping that somebody has worked with php's ssh2 commands and has had good luck and can recommend a direction for me. ssh2 is being loaded via extensions=ssh2.so php used is 4.3.10 webserver apache2 the server software is fedora 3 To add to the mix, previously I was using PHP's standard FTP functions and then had php execute local perl scripts that made the ssh2 connections for remote commands and it worked very well and I never experienced an incomplete response like this. Thanks again for the help.

« previous php.general (#213248) next »