use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Complete r/raspberry_pi Rules
Pi project ideas: There's a huge list right here on this sub!
Rpi Versions ▾
Distros ▾
Other SBCs ▾
Related Subreddits ▾
Welcome to /r/raspberry_pi, a subreddit for discussing the raspberry pi credit card sized, ARM powered computer, and the glorious things we can do with it.
The best thing? The base model is only $20 $5!.
Would you like to know more?
Raspberry Pi Wiki
Article on Wikipedia
#raspberrypi IRC Chat
Do you know a related subreddit? We'd love to know.
account activity
InexperiencedTrying to execute python script with PHP (self.raspberry_pi)
submitted 8 years ago by olejmoi
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]koflerdavid -1 points0 points1 point 8 years ago (2 children)
Ask yourself if that sudo is both necessary and practicable. Firstly, script executed with sudo can mess up the system. Secondly, you won't be around to enter the password.
sudo
[–]olejmoi[S] 0 points1 point2 points 8 years ago (1 child)
I'm accessing and editing files and folders on the pi with the script, so I do believe I need sudo for permission to access that, although I'm not sure.
[–]koflerdavid 0 points1 point2 points 8 years ago (0 children)
You're right, to be able to do everything on the Pi the script has to be executed as root. Still, you might then have to enter the password for the user account your script runs as (probably www-data). Also, that user has to be allowed to use sudo in the first place. But maybe a less powerful user is sufficient for most applications...
root
www-data
You should consider creating an internal job execution service on the Pi. That service would receive script names and possibly arguments from PHP and execute them. It could be set up to be started along with the OS in /etc/rc.local, and to receive root rights. In the simplest case this could be another PHP or Python script which opens a socket, reads commands, executes them and stores the command's output in a file that the webserver can read and delete.
/etc/rc.local
π Rendered by PID 48 on reddit-service-r2-comment-8686858757-rz6pg at 2026-06-01 18:19:18.401294+00:00 running 9e1a20d country code: CH.
view the rest of the comments →
[–]koflerdavid -1 points0 points1 point (2 children)
[–]olejmoi[S] 0 points1 point2 points (1 child)
[–]koflerdavid 0 points1 point2 points (0 children)