Motion - Support Question 2008x 04x 04x 110137

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
Topic revision: r3 - 05 Apr 2008, JackK
Copyright © 1999-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Please do not email Kenneth for support questions (read why). Use the Support Requests page or join the Mailing List.
This website only use harmless session cookies. See Cookie Policy for details. By using this website you accept the use of these cookies.