How to start Motion through php?
Question
I have tried the following two php commands but still cannot start the Motion though php. The motion can be started by typing the command line "motion" directly at the terminal.
1.
exec('motion');
2.
shell_exec('motion');
I also tested the command with "exec('ls -l'); and it works. Moreover, Motion can be quited by using the URL control.
Could we start the Motion though the php or Motion can only be start at the terminal directly?
5/4/2008
I have found out the problem. It is because the user "www-data" cannot access the /dev/video0 device. After I change the owership, it can be start though the Internet.
Environment
Motion version: |
3.2.3-2.1 |
ffmpeg version: |
|
Libraries: |
ffmpeg, mysql, postgresql |
Server OS: |
Ubuntu |
--
JackK - 04 Apr 2008
Answer
First , you should try to upgrade your motion to latest version 3.2.9 or even 3.2.10 ( release candidate ).
Motion has a built-in http control not related at all with apache , so you are stoping motion using this built-in http control.
You can use php , python , perl or whatever from apache to start / stop motion , but i think that best way is start motion with init.d script
and restart using http control.
Anyway if you want to control motion from apache using any embedded application be sure that motion has same permission of apache to access
to filesystem ( pid file , directory to save images & videos , etc ) and video dev.
--
AngelCarpintero - 05 Apr 2008