I realise that it is bad security practice to give www-data
full permissions with visudo. However, even with the highest permissions, privileged shell commands do not work.
PHP Code in /var/www/html/index.php
:
<?php
echo shell_exec("ls"); //expected output is echoed
echo shell_exec("bitcoin-cli getbalance"); //does not output anything
?>
If I type either command into the shell myself, I get the output I expect.
My sudoers file looks like this:
...
root ALL=(ALL:ALL) ALL
%admin ALL=(ALL) ALL
%sudo ALL=(ALL:ALL) ALL
#includedir /etc/sudoers.d
www-data ALL=NOPASSWD: ALL
Why is shell_exec("any command I like")
not working with this configuration?