SSH2 simultaneous connections

This is where you share YOUR scripts with others

Moderators: macek, egami, gesf

New php-forum User
New php-forum User
Posts: 1
Joined: Wed Nov 30, 2011 4:38 pm

SSH2 simultaneous connections

Postby hifake » Wed Nov 30, 2011 4:46 pm


I have to run a command in multiple servers simultaneously and get the results.
Is there a way to go to the next line in php before the current line completes execution?

$command = "grep foo /bar/*";
foreach ($servernames as $host) {
$stream = $objRx->exec_command($host, $command);

My objRx connects to the server using the host passed.

I have 3 servers in $servernames array. The command gets executed one server at a time. Since the search file is too large this takes a lot of time if I make one connection at a time.


User avatar
php-forum GURU
php-forum GURU
Posts: 2196
Joined: Wed Oct 06, 2010 11:19 am
Location: Happy Valley, UT

Re: SSH2 simultaneous connections

Postby egami » Thu Dec 01, 2011 6:37 am

Return to “Your Scripts”

Who is online

Users browsing this forum: No registered users and 3 guests