So the problem is that the error comes up in apache.err.
I CAN execute as the user in the shell.
root@ubuntu:~# su www-data
www-data@ubuntu:/root$ sudo /usr/local/bin/metronomectl restart
Stopped
Started
www-data@ubuntu:/root$
but when i try the same command through php
exec('sudo /usr/local/bin/metronomectl restart');
i get the error
sudo: PERM_ROOT: setresuid(0, -1, -1): Operation not permitted
user www-data IS in sudoers.
I'm at the end of my wits here... Any help is appreciated.
PS. Please ask if you need any extra info.
edit:
root@ubuntu:~# uname -a
Linux ubuntu 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
root@ubuntu:~#
sudoers line:
www-data ALL= NOPASSWD: /usr/local/bin/metronomectl