Can't Execute Python Script From Php
Solution 1:
Your problem is this: When launching the php script through the console, you are launching php with the permissions of your current user. When a process is executed through opening it in the browser, it will have the permissions of the user of your web-server-process.
Your group permissions will have to be 7 no matter what. Either change the python scripts permissions to 777
(read-write-execute for everybody) or change it to 770
and make sure that your web-servers user is inside the group set to the file.
Solution 2:
I had an issue similar while trying to build a web interface to change the image on an inky pHAT. Turns out www-data doesn't have access to GPIO.OUT. Tested by running "sudo -u www-data php index.php" and it returned the error I was looking for. So I give www-data GPIO permission "usermod -a -G gpio www-data" instead of adding to suddoers.
Post a Comment for "Can't Execute Python Script From Php"