开发者

How to know when exec() function is finish?

I have an exec function in php file that execs a bash script. It s开发者_Python百科cript calls fmpeg to transcode a video file.

How can I know when transcoding is finish??

$script = "/opt/lamp../name.sh"
exec("$script $videoIn $id")

I will try using next code but it doesn't workd.

if (exec("$script $videoIn $id"))
{
//print on screen that the video has been transcoded
}


The function exec() will return when the executed command is finished. My guess is that the command fails somehow (possibly because you're not using escapeshellcmd() and escapeshellarg()).


Your php script waits for the exec'd command to be finished before going on.

exec does not return the command's return value.

string exec  (  string $command  [,  array &$output  [,  int &$return_var  ]] )

you have to provide a var where that value will be written.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜