After spending several hours I found the solution. I needed to do the following things beside what the instructions on php-gpio says:
- in
myGpioScript
the first line had to be#!/usr/bin/php
instead of#!/usr/bin/env php
- I had to add
php
after-t
, like this:exec('sudo -t php /usr/bin/php ./myGpioScript');
(which makes sense when you think about it, but instructions doesn't say it like that) - I had to add this to the sudoers file:
www-data ALL=NOPASSWD: /usr/bin/php
- so that www-data can also run php without limitations. Specifying permission for the actual script files was actually not necessary!
File permissions on any of the files are not relevant either, so just leave them low.