Re: Implementing fdopen in PHP
| From: | Pierre Joye | Date: | Sun, 14 Mar 2010 14:41:27 +0000 |
| Subject: | Re: Implementing fdopen in PHP | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-47270@lists.php.net to get a copy of this message | ||
On Sun, Mar 14, 2010 at 3:39 PM, M. <karpeles@ookoo.org> wrote:
> Hi,
>
> Le dimanche 14 mars 2010 à 15:30 +0100, Keisial a écrit :
>> Creating a fdopen call is useless, since it needs a previous
>> descriptor to
>> work from, and all descriptors are equal. Where's that file
>> descriptor
>> coming
>> from?
>
> 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.
Cheers,
--
Pierre
@pierrejoye | http://blog.thepimp.net | http://www.libgd.org