note 19977 added to function.popen

From: Date: Sun, 17 Mar 2002 18:55:14 +0000
Subject: note 19977 added to function.popen
Groups: php.notes 
Request: Send a blank email to php-notes+get-27880@lists.php.net to get a copy of this message
Unfortunately many of these posting are wrong. First, you cannot use 'r+' or 'w+' in popen as it is defined to accept only reading or writing (unidirectional.) There does appear to be some kind of bug that returns the stdout into the page on pclose but this behavior can not be counted on. If you want a bi-directional popen, go to the bug database and lookup bug#9824. You can vote for a bi-directional popen there. The post describing the two 'named' pipes approach is currently the only way I can simulate the bi-popen(). THIS HAS A PROBLEM. Writers and Readers will BLOCK on pipes so you could have many webprocess waiting on blocked pipes. Also, notice that there could be race conditions as well since you can't gaurantee that the correct reader and writer get on the pipe at the same time. One web process maybe reading the writings of the WRONG mate process. I've tried every conceivable combo with popen, I even tried using popen in combo with only one named pipe for output. This hung though due to blocking behavior. Maybe if you compile in pcntl stuff you can get it to work, but that is not an option for me. -Sorry about the length -- http://www.php.net/manual/en/function.popen.php http://master.php.net/manage/user-notes.php?action=edit+19977 http://master.php.net/manage/user-notes.php?action=delete+19977 http://master.php.net/manage/user-notes.php?action=reject+19977

« previous php.notes (#27880) next »