I have a audio test command
speaker-test -c 2 -t wav | sleep 5
and it works fine when i type this in the linux shell window.
when i want to run this command using php
shell_exec("sudo -u usman speaker-test -c 2 -t wav | sleep 5");
It dont work and as i see the apache log i get this error message
sudo: no tty present and no askpass program specified
Then i Google and someone told to make the sudouser (in my case usman) a passwordless user.
What changes i have made in my /etc/sudoers files are
usman ALL=(ALL) NOPASSWD: ALL
I am really not sure how to get it working.