If I execute with shell_exec() an external program (unix) and it works for more than 30 seconds, PHP dies with Fatal error. That’s because external program hanged/crashed or I don’t know.
I want to catch this error. try{}..catch{} does not work in here. How can I tell if an external program has hanged? Usually my external program runs under 2 seconds.
You can use this function
system_with_timeoutdefined in the “run-tests.php” script, included in the source distribution:(the key is the last parameter passed to
stream_select)The timeout is given by passing an array like this:
array('TEST_TIMEOUT' => 200)as the second parameter.