Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:42605 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 69773 invoked from network); 13 Jan 2009 15:25:08 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Jan 2009 15:25:08 -0000 Authentication-Results: pb1.pair.com smtp.mail=php-php-dev@m.gmane.org; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=news@ger.gmane.org; sender-id=pass Received-SPF: pass (pb1.pair.com: domain m.gmane.org designates 80.91.229.2 as permitted sender) X-PHP-List-Original-Sender: php-php-dev@m.gmane.org X-Host-Fingerprint: 80.91.229.2 main.gmane.org Linux 2.5 (sometimes 2.4) (4) Received: from [80.91.229.2] ([80.91.229.2:55143] helo=ciao.gmane.org) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 39/A7-42308-052BC694 for ; Tue, 13 Jan 2009 10:25:05 -0500 Received: from root by ciao.gmane.org with local (Exim 4.43) id 1LMl8Y-0000Si-Ot for internals@lists.php.net; Tue, 13 Jan 2009 15:25:02 +0000 Received: from xdsl-87-78-166-71.netcologne.de ([87.78.166.71]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 13 Jan 2009 15:25:02 +0000 Received: from nc-figuraro by xdsl-87-78-166-71.netcologne.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 13 Jan 2009 15:25:02 +0000 X-Injected-Via-Gmane: http://gmane.org/ To: internals@lists.php.net Date: Tue, 13 Jan 2009 15:12:17 +0100 Lines: 88 Message-ID: <20090113151217.a17b4091.nc-figuraro@netcologne.de> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: xdsl-87-78-166-71.netcologne.de X-Newsreader: Sylpheed 2.6.0 (GTK+ 2.12.9; i686-pc-linux-gnu) Sender: news Subject: fork problem From: nc-figuraro@netcologne.de (Robert Figura) Hil Folks, I hope this is the right place to ask for help. Talking to people on #php on freenode convinced me that a developer's view might be required. For a log of the discussion on irc look here: http://spuerwerk.dyndns.org/~rfigura/php.fork-error.log This is the little php program that fails on my box: It says: Warning: system() [function.system]: Unable to fork [/usr/bin/showrgb] in /home/rfigura/www/u.php on line 2 PHP version 5.2.8 and glibc version 2.9 are installed. Using strace and ltrace i gathered more information: $ ltrace php u.php http://spuerwerk.dyndns.org/~rfigura/php-system-fork.ltrace.txt.gz This is the most interesting line: popen("/usr/bin/showrgb", "r") = NULL The call looks good but it shouldn't return NULL (which means an error occurred). I also did a system call trace: $ strace php u.php http://spuerwerk.dyndns.org/~rfigura/php-system-fork.strace.txt.gz At that point i wrote a small c program to see wether glibc works at all: #include #include int main(void) { FILE *f = popen("/usr/bin/showrgb", "r"); char buf[200]; while(!feof(f)) { int n = fread(buf, 1, sizeof(buf), f); fwrite(buf, 1, n, stdout); } pclose(f); return EXIT_SUCCESS; } But that works fine. Suggestions i received from helpful people included: * Maybe too many files are open? Looking at the strace shows that there are never more than three files opened at the same time. Also the total number of files opened is way smaller than the system limit * Maybe it is a memory problem in php. Aside that there is no allocation failure visible in the strace monitoring the process using sar showed that it never exceeds a couple of megabytes whereas phpinfo claims the php.ini value is 128M and the box has 2G... * Maybe safe_mode_exec_dir is wrong, try turning off safe mode Safe mode was never turned on to begin with. Also if the exec would be forbidden we would not see the call in the ltrace. Reading php's source didn't tell me more. * Maybe it is a permission problem? The problem also occurs with commandline php executed as root! * Yes but maybe it is a permission problem... The kernel has no additional security stuff like SElinux, capability dropping or any such things compiled in. The php executable does neither have the suid nor the sgid bit set and showrgb also looks good. * What does that ioctl from the strace do? It gets defined in soundcard.h and as far as i can tell it has nothing to do with the problem. Doing the trace dance on the c tesprogram (which works) shows the same ioctl with the same return value so it shouldn't be a problem. I was further asked to try the other ways to execute a file php offers. There's system(), exec(), passthru() and the `backtics`. They all fail with the same result. Even mail() breaks due to this problem If anyone has a clue what is going on here i'd be glad if you could tell me. Thanks in advance and kind regards Robert Figura