I have written a c program
that controls the parallel port ... and also written a .cgi
file which in turn executes the above c
program which turns 'on' an led attached to the parallel port.
This thing works fine when i execute the .cgi
file by giving permissions to execute. But when i try to do the same thing over the localhost(LAMP server) the .cgi
file is getting called but the c
program which it should call is not getting executed.
There seems to exist some permissions problem with the web server when trying to access the hardware.
1 Answer
Try running a Python CGI server like this in the directory with the executable: python -m CGIHTTPServer
, and calling it over HTTP. If it works, try switching users to the www-data
user (sudo su www-data -
) and try again. If it doesn't work, Python will show errors in the console.
You can try checking what groups your normal users belong to, and which users the www-data
user belongs to. Most likely, the www-data
user needs to be added to dialout
and/or plugdev
.