I am on a raspberry pi. The permissions of all the files including the python script which looks like this:
#!/usr/bin/python
from time import sleep
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD)
GPIO.setup(11, GPIO.OUT)
GPIO.output(11, False)
sleep(0.4)
GPIO.output(11, True)
sleep(1.6)
GPIO.output(11, False)
sleep(1)
is all owned by www-data and all the files are set to 777 (Yes, I know this is not smart but I'm trying to fix it this.)
It is run using sudo and my visudo file is here:
www-data ALL=(ALL) NOPASSWD: /var/www/gateopener.py /usr/bin/python /bin/chmod
And here is the PHP...
<?php
if (($_POST["safe2"]) != "good") {
header("Location: http://xx.xxx.xx.xxx/index.html");
}
ignore_user_abort(true);
set_time_limit(0);
`/usr/bin/sudo /var/www/gateopener.py`;
?>
Now someone tell me why the hell this isn't working? I have tried different variations of it (EI moving the file around, using different permissions.). I have tried using php's exec() function as well...Help me please.