I'm trying to build a small webapp in PHP that allows me to control my DSLR with my rpi2. I am using the gphoto2
program, which is a console program that talks with most ptp cameras and can take pictures and store them on the pc/rpi. The command is working when I run it from the shell as root, though I did run into issues while logged in as a normal user. So I went ahead and wrote a udev
rule to give 0666
to the device and allow everyone to use it which solved the problem with the user shell.
Next I wrote the PHP app that just runs a script that calls the gphoto2
command, and saves a picture in the same folder. Running the PHP code though the terminal with php -f
worked just fine, but when I made an HTTP request to run it through Apache, it would print an error in the log saying that it doesn't have permission to access the device, even though it's still in 0666
mode.
I don't really see what else could be the problem, since everything but Apache can access the device just fine. Also I'm not really comfortable with running Apache as root and I know it's incredibly unsafe.