Subject: pkg/32007: FreeBSD and PHP problem with --enable-memory-limit
To: None <email@example.com, firstname.lastname@example.org,>
From: None <email@example.com>
Date: 11/05/2005 23:33:00
>Synopsis: PHP cannot create pipes on FreeBSD with PHP using the default memory limit.
>Arrival-Date: Sat Nov 05 23:33:00 +0000 2005
>Release: FreeBSD 7.0-CURRENT
System: FreeBSD porticoluna 7.0-CURRENT FreeBSD 7.0-CURRENT #0: Tue Sep 27 07:09:02 CEST 2005 root@porticoluna:/usr/src/sys/i386/compile/KERN_PLUNA2 i386
I have been using FreeBSD from 4 to 7, always with pkgsrc, but I was unable to
call mail(), system() and other commands that uses pipes like popen() does.
After some debugging, I found the problem in PHP.
The default build flag of pkgsrc's PHP was to enable the --enable-memory-limit,
that makes PHP workable by default until it takes 8MB of memory.
On FreeBSD, when you call one of these functions, the process must require more
memory and this makes PHP to take more that 8MB of memory, forcing PHP to syslog
a string like that:
Fatal error 'Unable to read from thread kernel pipe' at line 1100 in file /usr/src/lib/libc_r/uthread/uthread_kern.c (errno = 0)
[Thu Nov 3 02:01:24 2005] [notice] child pid 70180 exit signal Abort trap (6)
This string is created when the process overflows the memory limit defined by PHP.
Just call mail() or system() on FreeBSD using pkgsrc with PHP.
The fix contains just a bigger limit for PHP, something like 64M is so logic, but disable
--disable-memory-limit would make the same effect on ther target system. But obviously
making the system 'vulnerable' to a DoS. (sysctl fixable).
cvs diff: Diffing .
RCS file: /pub/NetBSD-CVS/pkgsrc/www/php4/Makefile.php,v
retrieving revision 1.30
diff -u -r1.30 Makefile.php
--- Makefile.php 1 Nov 2005 23:12:15 -0000 1.30
+++ Makefile.php 5 Nov 2005 23:24:03 -0000
@@ -22,7 +22,7 @@
# Support for linking some PHP4 extensions statically into the php CGI and