I’m trying to implement a CRUD interface for the IP routing tables and I’m stuck at executing unix commands with PHP.
I’ve tried to echo the output for the route command using shell_exec command but the output is null.
echo shell_exec("route"); // Outputs nothing
I’ve also tried several other combinations like:
echo exec("route"); // also outputs nothing
// and
$lastLine = system("route", $output);
echo $lastLine; // nothing
echo $output; // 127
So, how should I execute the route command from PHP?
Thanks!
Try first from console
Then execute
routecommand with full pathBasically, i think, it because of
PATHenv is not include/sbin: