Question

I has been searching a long time in Google but not get what I looking for. I have an local web application for business in different building of my office. My staff will use this application in local network with both wireless devices and desktop computer. But I want to give them access through only limited devices and machines.

I can get the MAC address of connected devices by passing their IP addresses to arp, for instance:

arp -n 192.168.10.12

in terminal.

But I can't get any output when I run same command in php script

$output = shell_exec('arp -n 192.168.10.12'); echo "<pre>$output</pre>";

I tried some commands such as ls -l /var/www in shell_exec function, these commands display the same as in the command line. So my question is why I can't run arp -n ipaddress command and how to run it.

I can't check the MAC address via router because my business clients like to use my network when they come to my office.

Thanks in advance.

I followed this link.

Was it helpful?

Solution

I'm pretty sure the www-user is not allowed to use the arp command or reference to the full path.

Use its full path like /usr/sbin/arp.

It either works or sais no permission then. If no permission, search for sudo and let www-user access arp.

dan@big:/root$ /usr/sbin/arp
Address                  HWtype  HWaddress      Flags Mask            Iface
xxxx.xx.xx.xxxx  ether   00:00:XX:00:01:XX      C                     eth0

dan@big:/root$ arp
bash: arp: command not found
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top