Shell_exec returns permissions error

I’ve fixed it by getting the Linux user

shell_exec('whoami');

then copy the user and add it to the sudoers list