I use popen to open a stream to 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 fails on both streams (returning false, tested on a linux- and a windows-machine with php 5.3.). Using fread on both stream works fine, but I want to read from both streams "simultaneously" and fread keeps blocking reading from the other stream (by the way, stream_set_blocking returns fails, too, returning false).
Any idea why this isn't working?