Hi all,
I'm running a script on an OpenBSD box we have set up as a gateway for 350 students in our residences. Every once in a while (generally about once every 2 or 3 days), we get errors that the ARP table is empty (we use that to get a user's MAC address).
Since this is a gateway for 350 students, it's highly unlikely that the ARP table is actually empty - which leads me to question why, when I call shell_exec("arp -a") that the returned string is empty.
Is there any chance shell_exec() is returning before arp returns, thereby not catching the output generated by the call? I call the command twice in rapid succession and when the error happens, both calls are affected by it. Failing that <not really a PHP question> do you know how/if it's possible the ARP table is empty?</not>
Thanks.
shell_exec not returning output
Moderator: General Moderators
shell_exec not returning output
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
- AbraCadaver
- DevNet Master
- Posts: 2572
- Joined: Mon Feb 24, 2003 10:12 am
- Location: The Republic of Texas
- Contact:
Re: shell_exec not returning output
ARP entries / cache expire at some point. I think FreeBSD was every 60 seconds but I don't remember if it is per entry or for the entire cache. I thought OpenBSD was 20 minutes, but there is a kernel flag that is set that ARP uses to determine this.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Re: shell_exec not returning output
That expiry is on specific entries, not the whole cache.
Since I posted this, we discovered that arp isn't returning nothing, it's exiting with an exit code of -1. Unfortunately, it appears no one has ever encountered this, nor is there any documentation to explain why an arp lookup might be failing.
Since I posted this, we discovered that arp isn't returning nothing, it's exiting with an exit code of -1. Unfortunately, it appears no one has ever encountered this, nor is there any documentation to explain why an arp lookup might be failing.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.