I would like to execute a program using PHP, a piece of code that will use an RF transmitter to switch in my lamp.
This is achieved from the command line by:
action 63 A on
It is just a C program someone wrote to control the GPIO pins on my raspberry pi. So I make an index.php
<?php
exec('action 63 A off');
?>
It does nothing while:
<?php
echo exec('action');
?>
Gives me the default text output of the program (an explanation on parameters to use). This tells me PHP works, the program is located, it can be executed. But my lamp is not switching on. Moreover, typing on the command line:
php index.php
Does switch my lamp on/off as expected! (Using the first variety of the file) Is Nginx (user http) not allowed to switch the lamp on/off? It is allowed to execute the file, at least, it can make it generate text output.
I also tried:
<?php
system('action 63 A off');
?>
And some more varieties like shell_exec
And thoughts?