I have been trying to make a simple webpage as a GUI to execute my python script(s). Using apache on Pi 3 B+. The script executes in the terminal fine, turning a philips hue bulb on or off. However I cannot get it to exectue from the webpage.
The php also writes out to a text file to record the status of the bulb, and this part works fine. It just wont execute the python. I am using a simple self processing form, with two html buttons; when on is selcted switch.py should run. When off is selected, switchOff.py should run.
After days of research I believe it may be an issue with permissions and users, but I still cant get it working. This might not even be the problem?
I have given www-data ALL=(ALL) NOPASSWD: ALL in the sudo visudo file.
The python scripts are located in the /var/www/html file along with all my php/html/txt files.
The python scripts have the shebang #!/usr/bin/env python
I have included images of the code and the file permissions etc.
Has anyone else has this problem? How did you fix it? Any and all help is welcome.