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: <?php system( "/usr/bin/showrgb" ); ?> 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 <stdio.h> #include <stdlib.h> 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 -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php