solvable
Before writing a new question, I am looking for a solution all over the Internet. I have raspberry pi with apache2, php5.4, ssl. I want to execute a python script with php one. The PHP script is located inside / var / www, which has a resolution of 777. Php file:
shell_exec('python /home/pi/Desktop/Python/prova.py');
Prova.py has 750 permissions, but its owner is www-data, which is a user printed by shell_exec ("whoami"); which is working. Prova.py:
print "Hello World"
The script works directly from the command line:
php filename.php
This does not work with broswer!
Finally, I managed to execute the script from the browser. I had to add the www-data user to the sudoers file with my corresponding permission:
www-data ALL=(ALL) NOPASSWD: /etc/bin/python
source share