Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 07 Dec 2005 15:18:45 +0100
From:      Olaf Greve <o.greve@axis.nl>
To:        freebsd-questions@freebsd.org
Cc:        Polson Driessen <p.driessen@axis.nl>
Subject:   Memory limit issue (malloc) for PHP script under Apache
Message-ID:  <4396EF45.4090205@axis.nl>

next in thread | raw e-mail | index | archive | help
Hi all,

A colleague of mine has run into a weird issue, for which we hope 
someone knows a solution (or otherwise: if someone knows there's no 
(easy) solution, that's also good to know.

The issue: when running a script that will consume a large amount of 
memory (under FreeBSD 5.2.1-release i386, with custom kernel, with 
Apache 1.3.34_2, PHP 4.4.1 as mod_php4); Apache seems to deschedule the 
script in question as soon as it starts to consume over more or less 
512MB of memory; the machine has 1GB of memory, and at the moment of 
running the script the rest of the machine is pretty much idle.

The returned error in httpd-error.log is:
httpd in malloc(): error: allocation failed

We tried fiddling around with the php.ini and httpd.conf files, after 
Googling and trying stuff like RlimitMem (which apparently only seems to 
have effect for the CGI version of PHP and not the Mod version), but all 
to no avail.

The script that needs to be run will not be that easy to rewrite such 
that it'll use less memory; so we're hoping there's an easy trick to 
allow Apache to use more memory (say 900 MB).

Does anyone know how to achieve this?

Note: I'm aware that it would be better to tune the script, but as this 
is a one time brute force script; a quick work-around would be nice. :)

Tnx in advance, and cheers!
Olafo

PS: the command "limit -h" shows a datasize limit of 524000 bytes; this 
seems to be the limit that applies to Apache as well. Yet, changing to 
the csh and trying to set it to "unlimited" doesn't do any magic either 
and still doesn't supercede the above limit (unless I missed something)...



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4396EF45.4090205>