I am trying to call a script done in Python via browser with PHP. This script has only one command that serves to turn off my Raspberry Pi.
PHP looks like this:
<?php
exec('sudo python /home/pi/Documents/Programa/Script.py');
?>
Python script:
import os
os.system('sudo shutdown -r now')
I ran the program in Python and PHP (via terminal) separately and the two are working properly. Only when I call in the browser that it does not execute. I know I have to change permissions on folders and files, but I'm not sure exactly what directories I have to give these permissions because I'm a beginner in the PHP and Linux world. I've already looked at some other website means to do this.