Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP fork without having child inherit the parent's file descriptors?

Tags:

php

process

I'm trying to run a shell command using the backtick operators, but the fact that the child process inherits php's open file descriptors is problematic. Is there a way to keep this from happening?

I'm running PHP 5.1.2

like image 594
readonly Avatar asked Nov 06 '22 22:11

readonly


1 Answers

The only way I really know of is to have the children open up their own resources after forking.

There is a fairly decent tutorial on pcntl here:

http://www.hackingwithphp.com/16/0/0/miscellaneous-topics http://www.hackingwithphp.com/16/1/4/duplication-of-resources-when-forking

like image 114
Eli Avatar answered Nov 12 '22 17:11

Eli