0
$cmd ="ffmpeg ---" 
system($cmd);

Some ffmpeg command running ..at same time I want to run another system command like I shown

$cmd1 =" kill -9 pid" //above ffmpeg pid
system($cmd1)

Problem here occurring is I am not getting response from second system command

1 Answer 1

1

Maybe this will shed some light.. Quote from http://php.net/manual/en/function.system.php

Note: If a program is started with this function, in order for it to continue running in the background, the output of the program must be redirected to a file or another output stream. Failing to do so will cause PHP to hang until the execution of the program ends.

So your first command is currently running in the foreground, that's why the second command didn't execute.

In my opinion you can at least try running it in the background as

$cmd ="ffmpeg --- &" 
system($cmd);
Sign up to request clarification or add additional context in comments.

3 Comments

But i want system status after both command executed...process running background which meant cant get response!!!
It doesn't necessarily have to run in background. You just can't use the same output stream for two commands at the same time.
Have you tried using different outputs? Did it work for you? If yes, then please accept the answer, if not I'll try to help you further, but it should work I used it several times..

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.