Solved
Before writing a new question i search for a solution all over the web. I have a raspberry pi with apache2, php5.4,ssl. I want to execute a python script from php one. The php script is inside /var/www, which has 777 permission. Php file:
shell_exec('python /home/pi/Desktop/Python/prova.py');
Prova.py has 750 permission but his group owner is www-data, which is the user printed by shell_exec('whoami'); which works. Prova.py:
print "Hello World"
The script works directly from the command line:
php filename.php
It does not work from broswer!
Finally i succeed in execute the script from the browser. I had to add www-data user to sudoers file with its related permission:
www-data ALL=(ALL) NOPASSWD: /etc/bin/python