I am trying to control an RC transmitter from a PHP site. The command works fine as user xbian in the command line:sudo /home/xbian/433Utils/RPi_utils/codesend 34832404for example, and it works fine.So I am using this code on the php page:shell_exec(sudo /home/xbian/433Utils/RPi_utils/codesend {$num} >/tmp/debug.log 2>&1);And this line in sudoers:www-data ALL=NOPASSWD: /home/xbian/433Utils/RPi_utils/codesendAnd as expect I get an output file:sending code[34832404]Which I don't get without the sudoers line. So the command is running as sudo as it should but for some reason, after all this, it simply doesn't work like it does when I just run the shell command normally.The actual thing that requires sudo is the WiringPi library which is called in the C++ program codesend. I assume something is going wrong there but I have no clue how to troubleshoot it. No errors occur in the codesend program and nothing else it output from the command. I'm running PHP 5.4.4 and using Prefork mpm. This page is only accessible on my local network so I am not too worried about security at this point, just getting it to work.How can I figure out where the problem is?
Program acting differently depending on user
shell;sudo;php;raspberry pi