These forums are locked and archived, but all topics have been migrated to the new forum. You can search for this topic on the new forum: Search for running a csf command from php on the new forum.
hello - i am trying to run the following csf command from inside a php script:
$ipNbr = 199.231.184.25 ; // for example
$csfCommand = 'sudo /usr/sbin/csf --tempdeny ' . $ipNbr . ' 3600;' ;
$csfResult = shell_exec($csfCommand) ;
$csfResult = exec($csfCommand) ; // i also tried this
so far it does not do anything at all, include return any sort of error message.
i put the following line inside of visudo:
visudo ;
marksdomain.com ALL=(ALL) NOPASSWD: /usr/sbin/csf
any ideas how i can fire off the csf command from inside the php script ??
thank you all very much.
solution:
$csfCommand = '/usr/bin/sudo -u root -s /usr/sbin/csf --tempdeny ' . $ipNbr . ' 3600;'
marksDomain(dot)com ALL=(ALL:ALL) NOPASSWD: /bin/sh marksDomain(dot)com ALL=(ALL:ALL) NOPASSWD: /usr/sbin/csf