Re: Unable to get output from exec "ssh remote-server 'ping -c4 ip'"
| From: | hack988 hack988 | Date: | Thu, 07 Jan 2010 08:21:12 +0000 |
| Subject: | Re: Unable to get output from exec "ssh remote-server 'ping -c4 ip'" | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-300870@lists.php.net to get a copy of this message | ||
see this
http://www.phpclasses.org/browse/package/4282.html
2009/12/28 robert mena <robert.mena@gmail.com>:
> 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?
>