[FFmpeg-user] Calling FFmpeg from PHP: How to set logfile? (report)

Reindl Harald h.reindl at thelounge.net
Sat Jul 27 23:22:01 EEST 2019



Am 27.07.19 um 22:19 schrieb Peter B.:
> Thanks for your replies! :)
> 
> On 27/07/2019 21:18, Reindl Harald wrote:
>>> https://www.php.net/manual/en/function.putenv.php 
>> but how does it matter anyways?
> 
> Sure I found putenv before, but as I said: It felt a bit unnecessarily
> complicated ("overkill"), so I thought I'd better ask.

what is complicated when it comes to environment variables?

what do you gain from millions of options  compare dto follow standards?

>> you are supposed to use things like
>> https://www.php.net/manual/en/function.exec.php when you execute
>> binaries like ffmpeg
> 
> I know. That's what I'm doing.
> btw: The PHP article in the wiki only mentions "shell_exec()" - and no
> means of evaluating any exitcode to see if the FFmpeg call was
> successful or not. So I found "exec()" to actually be the better option
> (for me?)
> 
> So I'm now doing the following and it seems to work quite well:
> 
> 1) Add "2>$logfile" at the end of the command to redirect stderr to file.
> 2) Use "exec($command, $output, $exitcode)" - and then check if
> ($exitcode != 0).
> 
> Seems to work quite well!

that's how unix systems are supposd to work, no matter if the cvaller is
PHP or whatever binary or scripting language


More information about the ffmpeg-user mailing list