PDA

View Full Version : [ubuntu] shell_exec permission


aremint
March 14th, 2010, 12:28 AM
i have a problem run following script

<?php
$output=shell_exec(sudo /sbin/iptable <command>).
echo $output;
?>

i already adding "www-data ALL=NOPASSWD: ALL” in my etc/sudoers folder but it still not working. i really appreciate if somebody can help me and give step to solve it.

lisati
March 14th, 2010, 12:33 AM
Shouldn't that be iptables?

aremint
March 14th, 2010, 01:15 AM
it still not working. i have replace new script but nothing happen.

<?php
$output = shell_exec("echo 'password' | sudo -s /sbin/iptables <command>");
echo "<pre>$output</pre>";
?>

Ryan Dwyer
March 14th, 2010, 06:43 AM
tail /var/log/apache2/error.log

You could also put error_reporting(E_ALL) and ini_set('display_errors','on') before your shell_exec() code.