PHP stream_set_timeout and popen not working together?

I use popen to open a stream for 2 other php scripts:

$proc[0] = popen("/usr/srv/php /my/folder/myscript.php 0 &", "r"); 
$proc[1] = popen("/usr/srv/php /my/folder/myscript.php 1 &", "r");
if (!stream_set_timeout($proc[0], 1, 0)) print "stream_set_timeout failed on stream 1"; 
if (!stream_set_timeout($proc[1], 1, 0)) print "stream_set_timeout failed on stream 2";

What happens is that stream_set_timeout does not work in both streams (returns false, is checked on linux and windows machine with php 5.3.). Using fread on both threads works fine, but I want to read from both threads "at the same time", and fread continues to block reading from another thread (by the way, returning the stream stream_set_blocking also returns false).

Any idea why this is not working?

+3
source share

All Articles