I try to execute the following PHP command to get the IP-adress from eth0.
$ip = trim(shell_exec("/sbin/ifconfig eth0 | grep -i 'inet Adresse:' | tr ':' ' ' | awk '{ print $3 }'"));
But i get nothing back. If i execute the exact same command via ssh then i get the IP, so the command should work.
I opened visudo and added these lines and restarted apache2 after it
www-data ALL = NOPASSWD: /sbin/ifconfig
www-data ALL = NOPASSWD: /bin/grep
www-data ALL = NOPASSWD: /usr/bin/awk
www-data ALL = NOPASSWD: /usr/bin/tr
But i still get nothing back
برچسب:
نویسنده: استخدام کار