note 97610 modified in function.ssh2-exec by danbrown

From: Date: Wed, 28 Apr 2010 14:52:34 +0000
Subject: note 97610 modified in function.ssh2-exec by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-168760@lists.php.net to get a copy of this message
Oddly enough, I've noticed if I attempt to execute anything nothing happens. Now, I don't mean "No content is returned!".. I mean, "The command I told it to execute didn't execute!". Unless the following pattern is followed: <?php $stream = ssh2_exec($connection, "touch ~/some_fake_file", 'xterm'); stream_get_contents($stream); ?> Nowhere in the manual does it imply that stream_get_contents is required for the actual execution to take place, but in this case.. it seems that way. So, if you're having trouble getting commands to execute, try using stream_get_contents(). --was-- Oddly enough, I've noticed if I attempt to execute anything nothing happens. Now, I don't mean "No content is returned!".. I mean, "The command I told it to execute didn't execute!". Unless the following pattern is followed: $stream = ssh2_exec($connection, "touch ~/some_fake_file", 'xterm'); stream_get_contents($stream); Nowhere in the manual does it imply that stream_get_contents is required for the actual execution to take place, but in this case.. it seems that way. So, if you're having trouble getting commands to execute, try using stream_get_contents(). http://php.net/manual/en/function.ssh2-exec.php

« previous php.notes (#168760) next »