Jump to content

using shell_exec to implement linux route command


ashbladerunner

Recommended Posts

hello. i am having a puzzling problem. i need to implement the linux route command with php. i have searched the web and came up with a couple of functions that can execute it: exec, system, pushthru and shell_exec. the last one was the most satisfying. the problem is that i managed to get the basic route command to work and i can visualize the IP routing table but the route add/del commands don't work. i can show you some of the examples i have tried but none of them work. i have disabled SElinux under fedora and even changed sudoers file to accomodate my user. none of them work. i can't get the add/del to work. can anyone help me with this?

 

$answer = system("route del 192.168.183.5",$ret_val);

 

$add = shell_exec("/sbin/route del 192.168.183.5");

 

echo `route del 192.168.183.4`;

 

$defaultRoute = shell_exec("route add 192.168.183.8 gateway 192.168.183.2");

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.