Raspberry PI: PHP call python script with sudo Raspberry PI: PHP call python script with sudo nginx nginx

Raspberry PI: PHP call python script with sudo


for future reference:

I found a - i my eyes - not really nice solution:

sudo echo "apache ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers

Found here.


Mm, i have try with this two simple example:

/Scripts/test.py

#!/usr/bin/env pythonprint (str('hello world'))

/var/www/test.php

<?phpecho shell_exec('/Scripts/test.py');?>

via a browser, show me "hello world"

Perhaps try this:

chmod a+x your_py_file.py

Hope that help..