Re: Dettach problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



grape wrote:
> Hello Richard,
> 
> Richard Lynch skrev:
> 
>>
>> This seems to me like a cogent bug report...
>> http://bugs.php.net/
>>  
>>
> Yup, I'll report it if we cannot find a explaination in a couple of days.

as a last resort you might as on internals@xxxxxxxxxxxxx as to whether
anyone there considers this a possible bug.

> 
>> But what does the posix_setsid() bit do?  Seems like you could take
>> that out too, no?...  Or does that "promote" the process to "be" the
>> parent somehow?...  Thereby confusing "fork" into thinking that it's
>> not the child process in some twisted weird way?  I read the docs ;
>> But comprehension is not implied. :-)
>>  
>>
> The documentation on posix_setsid() is a bit sparse on php.net, but the
> manpage for setsid on my FreeBSD system gives:
> 
> DESCRIPTION
>     The setsid() system call creates a new session.  The calling process is
>     the session leader of the new session, is the process group leader of a
>     new process group and has no controlling terminal.  The calling process
>     is the only process in either the session or the process group.
> 
> I found a post on the net describing how to run a PHP-script as a
> daemon, and the author used posix_setsid() for it to work. Actually, the
> posix_setsid() isn't really required to disconnect the childs I/O using
> PHP 5.0.4, I can just do:
> 
> <?
> echo "Hello from parent\n";
> 
> if(pcntl_fork()) {
>   exit;
> }
> 
> fclose( STDIN );
> fclose( STDOUT );
> fclose( STDERR );
> 
> echo "This message should not go to stdout\n";
> ?>
> 
> This is was I originally had in my code, but after moving to 5.1.2 I
> started to experiment... :-)
> 
> A while ago, I discovered that PHP 4.3.10-2 (cli) on a Debian Linux with
> 2.4.27 kernel "misbehaves" as well, using posix_setsid() or not. I see
> the output of the last echo command on stdout of the parent process
> there also.
> 
> The plot thickens!
> 
> /Grape
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux