krishprasads
Posts: 3
Joined: Wed Mar 27, 2013 6:13 pm

PHP to control Python scripts (for GPIO)

Sat May 11, 2013 6:13 am

Hi.

I found this piece of code here {http://www.raspberrypi.org/phpBB3/viewt ... =32&t=8429}, that can execute Python scripts from PHP.

I've installed apache2 on the Pi and I'm able to access the PHP script. But when I press the HTML buttons, nothing happens! :(

When I execute the python script via SSH, it works.. so theres nothing wrong with the python scripts I think.

I'm using WebIOPi to monitor the status of the GPIO pins.

Whats the mistake?

PS: I know that this may not be a very safe approach to control the GPIO. I just wanna give it a try though :)

TIA.

geekinthesticks
Posts: 96
Joined: Fri Feb 08, 2013 7:22 pm

Re: PHP to control Python scripts (for GPIO)

Sat May 11, 2013 12:16 pm

It's probably a permissions problem. Your script will be running as whatever user apache runs under. I think that accessing GPIO generally requires root access.

austinp
Posts: 15
Joined: Thu May 09, 2013 1:35 pm

Re: PHP to control Python scripts (for GPIO)

Mon May 13, 2013 5:02 am

geekinthesticks wrote:It's probably a permissions problem. Your script will be running as whatever user apache runs under. I think that accessing GPIO generally requires root access.
Seconded.

Return to “Automation, sensing and robotics”