On Mon, Mar 15, 2010 at 1:41 AM, Pierre Joye <pierre....@gmail.com> wrote:>

> > When you spawn a new program, you can pass it additionnal descriptors on
> > top of stdin/stdout/stderr.
> >
> > For example look at proc_open(). You can pass more than 3 descriptors,
> > and communicate if the program is able to use them.
> >
> > An alternative on linux is to $fp = fopen("/proc/self/fd/3","r+")
>
> That's what proc_open does and allows.
>

So in my case, the erlang server is doing the equivalent of proc_open() to
call my PHP program. My PHP program needs
a way to access these 'extra' file descriptors.

I'm fine with using fopen("/proc/self/fd/3","r") for now, but something like
fdopen() would be more appropriate IMHO so that
it will work on platforms other than linux.


Slightly off topic, but another useful application of fdopen() is for hot
swapping a running program.
http://nathanwiegand.com/wp/2010/02/hot-swapping-binaries/
I realise this is probably not a priority for PHP, but I actually enjoy
writing network servers in PHP and this would be a pretty awesome feature.

Regards,
Dennis Hotson


(PS. Sorry for the dupe Pierre, I forgot to reply to the list.)

Reply via email to