0

Do I have a chance to find the pid of the application I'm running with popen?

I know it's possible with proc_open but it's unlikely for me to change my app's structure

Or how can I stop the process that is opened with popen and continues to run?

When encoding stream with ffmpeg sometimes I need to stop

SweetNGX
  • 153
  • 1
  • 9

1 Answers1

0

function popen: https://www.php.net/manual/en/function.popen.php

function pclose: https://www.php.net/manual/en/function.pclose.php

Where pclose will return -1 if it could not close the process.

If pclose cannot close the process run popen & use a system command to kill the process by getting the parent pid of the forked process:

Killing processes opened with popen()?

Very last answer may work, otherwise use proc_open:

https://www.php.net/manual/en/function.proc-open.php