html - Running imagesnap in PHP with Mac Server -


i trying develop small site take snapshots of house using webcam connected to mac mini @ home. mac mini running os x server. webcam logitech hd pro webcam c920 (usb connected). based on php , html5 (no other code besides css).

my development machine macbook pro using internal isight camera. not running os x server; manually enabled apache , php. while developing site on laptop, worked flawlessly. when installed on mac mini imagesnap program turns on camera never finishes; have manually kill process, , snapshot never created.

the following error logged:

imagesnap[2363]: *** qtcapturesession warning: session received following error while decompressing video: error domain=nsosstatuserrordomain code=-12903 "the operation couldn’t completed. (osstatus error -12903.)". make sure formats of video outputs configured. 

this when running site directly. if run same program command-line, works fine... running _www user!

sudo -u _www bin/imagesnap images/snapshot_$date.jpg 

this code call in php:

<?php  if(isset($_post['submit'])) { system('bin/run_imagesnap.sh', $return_value);         if ($return_value) {                 echo "the command failed.";         } } ?> 

i unable figure out how write date output filename (i'm noob php), used bash script me (i'm better bash):

#!/bin/bash  date=`date +"%m-%d-%y_%t"` bin/imagesnap -q -w 3 images/snapshot_$date.jpg 

i've tried exec(), passthru(), , shell_exec() same results.

finally, i've tried following: create test.php, put code:

<?php system('bin/run_imagesnap.sh', $return_value);             if ($return_value) {                     echo "the command failed.";             } ?> 

and ran on command-line _www user using php-cli:

sudo -u _www php test.php 

and worked fine (created snapshot file , did not give error).

i'm thinking maybe has os x server app, google searches return nothing.

i'm stumped. why break when run same exact code on browser works fine on command-line using same exact tools , user?

unknown if correct way, ended using sudo run script.

visudo 

and give _www user passwordless root access script:

_www    all=nopasswd: /path/to/script 

and works. there's more 1 way skin cat..


Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -