If you are just checking to see if the IP is pingable, but don't care about the output you could just test against the exit code: $host = 'hostorip'; $sshhost = 'hostorip'; $alive = trim( shell_exec( 'ssh ' . $sshhost . ' ping -q -n -c 5 -W 2 ' . $host . ' \>/dev/null 2\>\&1 \&\& echo "Alive"' ) ) == 'Alive'; var_dump( $alive ); I use a variant of the above with good success on Gentoo. Adam. On Sun, Dec 27, 2009 at 1:53 PM, robert mena <robert.mena@xxxxxxxxx> wrote: > Hi, > > I need to develop an interface that will, for example, ping IPs from a > remote server. So the php script will be hosted in a server with ssh access > (key) to the remote server. > > I can make it work from the console but when I try > > $cmd = "ssh remote-server 'ping -c 4 ip'" > exec($cmd, $ouput); > > the output is empty. > > the same command (with the remote-server and IP changed to the real ones) > works fine from command line. > > I've added the key/config in the webserver's user .ssh directory so I am > assuming that that there is something wrong with my setup. > > any ideas? > -- Adam Randall http://www.xaren.net AIM: blitz574 Twitter: @randalla0622