Unfortunately, I found that all solutions for running external programs are not suitable, so I use my own implementation, which is pcntl_execafter pcntl_fork.
But now I need to redirect the stderr / stdout of the executable to some file. Obviously, I have to use some kind of dup2Linux call after pcntl_fork, but the only one dup2that I see in PHP is eio_dup2that it looks like it doesn’t work with regular threads (like stderr / stdout), but with some asynchronous threads.
How can I call dup2from PHP or how can I redirect std * without it?
There are no answers to this question (although without details): How to call the dup2 () system call from PHP?
source
share