opencombatclan Posted July 14, 2009 Share Posted July 14, 2009 I am trying to get my php firewall script to work. I use the following code: <?php $ip1 = "123.123.123.123"; exec("iptables -A INPUT -s $ip1 -j DROP 2>&1", $output); print_r($output); ?> But I get iptables v1.3.5: can't initialize iptables table `filter': Table does not exist (do you need to insmod?) Perhaps iptables or your kernel needs to be upgraded When I do exec("ls -a 2>&1", $output); it works perfectly fine. I have no idea how to solve it. The php file is chmodded to 777 and has owner: root If I login on my ssh and execute the command thru putty it works perfectly fine! I have no idea how to fix this, I slept a few nights but I cant come up with a good solution. I really hope you guys can help me out Link to comment https://forums.phpfreaks.com/topic/165953-php-exec-not-working-properly/ Share on other sites More sharing options...
rhodesa Posted July 14, 2009 Share Posted July 14, 2009 the php script is being run by the web process...does the web process have all the rights it needs to work? Link to comment https://forums.phpfreaks.com/topic/165953-php-exec-not-working-properly/#findComment-875268 Share on other sites More sharing options...
J.Daniels Posted July 14, 2009 Share Posted July 14, 2009 PHP is actually executing the command. The problem lies with the iptables setup. If you control the server here is something that I found that may help: http://www.linuxquestions.org/questions/linux-networking-3/iptables-v1.3.8-cant-initialize-iptables-table-filter-577212/ If you are hosted, you'll have to contact your host. Link to comment https://forums.phpfreaks.com/topic/165953-php-exec-not-working-properly/#findComment-875271 Share on other sites More sharing options...
opencombatclan Posted July 15, 2009 Author Share Posted July 15, 2009 But it is working in ssh, thats so confusing... EXACT same command is working in ssh. @rhodesa How do I check if the web process has the correct rights? And I am owner of that dedi server Link to comment https://forums.phpfreaks.com/topic/165953-php-exec-not-working-properly/#findComment-875761 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.