Using webpage with PHP to control the GoPiGo


I am trying to control my GoPiGo using a web page,
so I added a PHPweb page to my raspberrypi 3 with a clickable immage,
the position of the mouse are forwarded to the PHP web page
from here I call a Python script that recieves the x and y of the mouse click so far this works.

But it is not possible to import the gopigo for this will result in the following error:
Traceback (most recent call last): File “/home/pi/remote/”, line 4, in import gopigo File “build/bdist.linux-armv7l/egg/”, line 49, in IOError: [Errno 13] Permission denied

probably from PHP a different user is used to execute my and it does not have enough rights

anybody any idear how to resolve this?


Interesting project you have here. Nice little challenge! :slight_smile:

Is it possible for you to run your with sudo?
Your user that runs the PHP, what groups is it part of? My guess is that it needs to be part of the i2c group but this is just a guess.

Could you try that and let me know if I have a good sixth sense or not ? :slight_smile:


Yes that is the problem,

i added the following line to the sudo file using the command:
sudo visudo

for the php page uses the user www-data, i adding the line:

so now i can start the python scripts from the php script with:
$command = ‘sudo python /home/pi/remote/ ‘. $x .’ ‘. $y .’ 2>&1’;
$result = shell_exec($command);
echo $result;

redirecting the error output and echoing it to the web browser is very use full to find bugs, typo’s etc.


So you’re all up and running ?