I'm looking for a way to run a PHP process with a timeout. Currently I'm simply using exec()
, but it does not provide a timeout option.
What I also tried is opening the process using proc_open()
and using stream_set_timeout()
on the resulting pipe, but that didn't work either.
So, is there any way to run a command (a PHP command to be precise) with a timeout? (PS: This is for cases where the max_execution_time
limit fails, so no need to suggest that.)
(By the way, I also need to retrieve the return code of the process.)
See Question&Answers more detail:os