Answer the question
In order to leave comments, you need to log in
Why is the iptables command not being executed via PHP's exec() function?
I'm trying to execute the iptables command through PHP, the code is this:
exec("sudo iptables -I INPUT -s ".$enemy_ip." -j DROP");
exec("sudo iptables save");
The result should be adding some IP address to the iptables table, but it doesn't. Other commands run smoothly, for example top works fine. Iptables works correctly from the console, everything is added perfectly. By the way, the same code works correctly on another server with the same settings as the one on which it cannot be executed. No errors are displayed, nothing is written about rights. What can you try? Where to dig?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question