Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re: CGI fork() inherits

by andal (Hermit)
on Feb 14, 2012 at 09:20 UTC ( #953662=note: print w/ replies, xml ) Need Help??

in reply to CGI fork() inherits

Effectively, fork inherits everything from it's parent, even memory. But it gets "copy" of everything. If the child performs "exec", then new process inherits only file descriptors that have FD_CLOEXEC flag cleared. Usually, this is used by the Web server that starts CGI scripts. The server establishes stdout and stdin of the forked child to use created by the Web server pipes and then does "exec" that will run CGI script.

Looks like, your Web server waits till the CGI script closes both STDOUT and STDERR. Which means, that actually all of the data sent to STDERR goes first to Web server and then Web server forwards it to appropriate log file. Most likely, your script does not have enough privileges to open that file. The simplest solution is for your forked child to use different file.

Comment on Re: CGI fork() inherits

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://953662]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (9)
As of 2015-11-27 12:25 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (727 votes), past polls