note 82109 added to function.ssh2-sftp-stat
| From: | vanscotongemail at osu1 dot php dot net | Date: | Thu, 27 Mar 2008 20:53:36 +0000 |
| Subject: | note 82109 added to function.ssh2-sftp-stat | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-137644@lists.php.net to get a copy of this message | ||
for some unkwon reason, stream_set_timeout() does not work on ssh2_exec, and strem_set_blocking (on
my personal case) just hangs the script until it hits the max_execution_time.
Using sleep() or usleep() does not help either, because they are arbitrary and the command passed to
ssh2_exec may have not finished yet.
The (best?) way to workaround this case was using a sh script on the remote server an a file as a
handshake, the using this function to stat the file and, given a certain rule, fetching the result
using stream_get_contents().
The sh script should create a dummy not zero size file (the handshake), run the commands then
truncate the file (finished execution of the command). On the other side, the php script, should be
stating the file until it gets a 0 size and then fetch the results.
I hope that this would be usefull to somebody else until stream_set_timeout() works on ssh2_exec or
the functions adds a "timeout" parameter.
----
Server IP: 200.24.234.70
Probable Submitter: 200.27.27.9
----
Manual Page -- http://www.php.net/manual/en/function.ssh2-sftp-stat.php
Edit -- https://master.php.net/note/edit/82109
Del: integrated -- https://master.php.net/note/delete/82109/integrated
Del: useless -- https://master.php.net/note/delete/82109/useless
Del: bad code -- https://master.php.net/note/delete/82109/bad+code
Del: spam -- https://master.php.net/note/delete/82109/spam
Del: non-english -- https://master.php.net/note/delete/82109/non-english
Del: in docs -- https://master.php.net/note/delete/82109/in+docs
Del: other reasons-- https://master.php.net/note/delete/82109
Reject -- https://master.php.net/note/reject/82109
Search -- https://master.php.net/manage/user-notes.php