PDA

View Full Version : [ubuntu] run webcam server start script from browser.



JointTech
January 26th, 2012, 12:26 PM
I have a php script which contains:

shell_exec("/etc/init.d/webcam-server start");
sleep(3);
shell_exec("streamer -o /var/www/images/topshots/{$today}.jpeg");
sleep(3);
shell_exec("/etc/init.d/webcam-server start");

This works correctly if I run from a command line
php /var/www/takepicture.php

However if I run it from a browser either http://localhost/takepicture.php or from another pc at http://ipaddress/takepicture.php it does not work.

This part of the code Does work from a browser.

shell_exec("streamer -o /var/www/images/potshots/{$today}.jpeg");


Its only the start and stop scripts that dont seem to have the proper permissions or something.
running Ubuntu 10 LTS Desktop version

JointTech
January 26th, 2012, 10:30 PM
I was able to get it to work by changing apache to run as my local user account. This is a closed system and security is not a concern.