开发者

How do I use proc_open() with a non-standard file descriptor on Linux?

The proc_open() documentation states that it's possible to use other file descriptors than the standard ones:

The file descriptor numbers are not limited to 0, 1 and 2 - you may specify any valid file descriptor number and it will be passed to the child process.

But how do you actually go about doing this?

What do you need to do on the parent and child process to for example use an extra input and output pipe with a proc_open call?

Edit:

A related question - If the launched process was also a PHP function, you can access an arbitrary fd开发者_运维问答 in PHP with the stream wrapper php://fd/3 (replace 3 with the fd number), but this feature is only available in PHP 5.3.6+. Is there any way of accessing an arbitrary fd in PHP 5.2?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜