Issue
I have an infinite loop in a PHP script that read my gpio (with wiringPI) in this manner
$newstatus = trim(exec("gpio read ".$gpioline[$i]));
and this line in rc.local
to start on boot
php /root/CheckGPIO.php &
the issue is that when the script is started automatically on boot $newstatus
is an empty string variable instead executing php /root/CheckGPIO.php &
from the terminal once i have terminal access, all is working good and i get the gpio value in $newstatus
what can cause the issue?
PS. looking at output exec("whoami") script is ever executed as root
Solution
The issue was PATH
not defined when the script called from rc.local
Answered By - FrancYescO