ashbladerunner Posted December 16, 2009 Share Posted December 16, 2009 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"); Link to comment https://forums.phpfreaks.com/topic/185404-using-shell_exec-to-implement-linux-route-command/ Share on other sites More sharing options...
trq Posted December 16, 2009 Share Posted December 16, 2009 You would need to use sudo to gain sufficient permissions to execute the route command. Link to comment https://forums.phpfreaks.com/topic/185404-using-shell_exec-to-implement-linux-route-command/#findComment-978815 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.