Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:2084 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 35948 invoked from network); 29 May 2003 19:44:11 -0000 Received: from unknown (HELO secure.thebrainroom.com) (213.239.42.171) by pb1.pair.com with SMTP; 29 May 2003 19:44:11 -0000 Received: from zaneeb.brainnet.i (IDENT:root@brain.dial.nildram.co.uk [195.149.29.154]) by secure.thebrainroom.com (8.9.3/8.9.3) with ESMTP id UAA24904; Thu, 29 May 2003 20:44:09 +0100 Received: from zaneeb.brainnet.i (IDENT:wez@zaneeb.brainnet.i [127.0.0.1]) by zaneeb.brainnet.i (8.11.6/8.11.6) with ESMTP id h4TJiA820474; Thu, 29 May 2003 20:44:10 +0100 Date: Thu, 29 May 2003 20:44:10 +0100 (BST) X-X-Sender: wez@zaneeb.brainnet.i To: Brian Moon cc: internals@lists.php.net In-Reply-To: <01c301c3260b$512bda30$0100a8c0@doughboy> Message-ID: References: <01c301c3260b$512bda30$0100a8c0@doughboy> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: Re: [PHP-DEV] exec in CLI vs. mod_php From: wez@thebrainroom.com (Wez Furlong) Under apache, you inherit all of the apache sockets when the libc forks and execs your script. This causes some problems (there are one or two bug reports about this in the bug db) with processes waiting around on the sockets. It looks like there was some code in the apache SAPI to avoid this problem, but it is currently commented out with an explanation that it is "problematic". I've asked about this problem a few times, but no one seems to notice my questions or have time to reply. So, we know of the problem, we know roughly how to fix it, but no one can explain why we can't fix it :) --Wez. On Thu, 29 May 2003, Brian Moon wrote: > I am trying to figure out what is internally different about exec between > CLI and mod_php. > > If exec() a script from CLI and said script forks, I get my prompt right > back. > > test.php > ------------ > > exec("/home/brianm/fork.php"); > > ?> > > > fork.php > ------------ > #!/usr/local/bin/php > > $pid = pcntl_fork(); > > if ($pid == -1) { > trigger_error("Could not fork __FILE__", E_USER_ERROR); > exit(); > } elseif($pid>0) { > exit(); > } > > touch("/tmp/file.txt"); > sleep(5); > > ?> > > However, if I run test.php from mod_php in Apache, the parent zombies and > exec() waits for the forked process to finish. > > What is the difference here and is there any hope of having exec in mod_php > work the same as it does in CLI? > > Brian Moon > dealnews.com > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > >