php - Handle Raspberry Pi camera via Apache -


i'm trying image of raspi camera via php script. it's installed php5, apache2 , necessary stuff.

snippet: /var/www/img.php

if(isset($_get['pic']))     system("sudo raspistill -w 512 -h 320 -o /var/www/img/img.jpg"); 

when run command directly in terminal it's working, php script not. sudo php /var/www/img.php?pic i'll error:

could not read input file: /var/www/img.php 

first thought it's problem permissions, isn't working root privileges.

have idea? i'm depressed..

thanks lot!

solution

first it's necessary change owner of apache directory:

sudo chown www-data:www-data -r /var/www 

after it's not necessary prepend sudo:

exec('raspistill ...'); 

it's possible popen, system, ...


Comments

Popular posts from this blog

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - UML - How would you draw a try catch in a sequence diagram? -

c++ - No viable overloaded operator for references a map -