I'm running ubuntu 11.10. I want to be able to call a shell script from php and run that script as root. When my php attempts to call the shell script as root --like this:
$output = shell_exec('sudo /var/www/my_script.sh')
I get this error in the apache log:
sudo: no tty present and no askpass program specified
I've changed the owner of the php script to root:root. I've added this line to sudoers:
www-data ALL = NOPASSWD:/var/www/my_script.php
I realize that I'm supposed to comment out this line in sudoers:
However, there's no such line in my sudoers file. What do I need to do to get past this error?