php-fastcgi and memory leaks

Phillip B Oldham phill at
Mon Mar 31 16:28:22 MSD 2008

Grzegorz Nosek wrote:
> If you use 'ps auxf', you'll probably see that one of the php-cgi
> processes is the master, with all others hanging off from it as its
> children. By that time, spawn-fcgi is long gone (it called exec...() and
> became the master php process). BTW, do you really see increasing memory
> usage on all the processes including the parent?
Yes, all processes, including the parent. I've set-up 3 children and one 
parent, and all 4 instances slowly grow in size.
> spawn-fcgi isn't really a process manager, it just starts your fastcgi
> server and hopes for the best. Anyway, only the php interpreter is to
> blame here.
Thats what I thought.
> It shouldn't matter at all, the memory used for e.g. php code and
> variables should get properly freed at the end of the request. You might
> leak resources (database connections etc.) though. Are you using any
> non-standard php extensions?
I don't know about non-standard. I'm not using any PECL entensions, but 
I have custom compiled the php instance on the box to include items such 
as IMAP support and turn off things that we don't use. My compile 
options are below:

./configure \
--disable-all \
--disable-ipv6 \
--disable-short-tags \
--disable-cli \
--with-zend-vm=GOTO \
--without-pear \
--enable-inline-optimization \
--enable-fast-install \
--enable-fastcgi \
--enable-discard-path \
--enable-force-cgi-redirect \
--enable-zend-multibyte \
--enable-sigchild \
--enable-libgcc \
--enable-static \
--enable-libxml \
--enable-dom \
--enable-mbstring \
--enable-spl \
--enable-gd-native-ttf \
--enable-exif \
--enable-pdo \
--enable-session \
--enable-simplexml \
--enable-soap \
--enable-sockets \
--enable-zip \
--enable-bcmath \
--enable-ctype \
--enable-json \
--enable-posix \
--enable-reflection \
--enable-tokenizer \
--enable-xml \
--with-config-file-scan-dir=/etc/php5 \
--with-pcre-regex \
--with-pcre-dir \
--with-libxml-dir \
--with-openssl \
--with-kerberos \
--with-zlib \
--with-bz2 \
--with-curl \
--with-curlwrappers \
--with-gd \
--with-jpeg-dir \
--with-png-dir \
--with-ttf \
--with-freetype-dir \
--with-gettext \
--with-imap \
--with-imap-ssl \
--with-xmlrpc \
--with-xsl \
--with-iconv \
--with-mysql=/usr/local/bin \
--with-mysql-sock=/var/lib/mysql/mysql.sock \
--with-pdo-mysql=/usr/bin/mysql_config \
--with-gdbm \
--with-imap \

Don't know if any of those items are known to cause memory leaks.


*Phillip B Oldham*
The Activity People
phill at <mailto:phill at>



This e-mail and its attachments are intended for the above named 
recipient(s) only and may be confidential. If they have come to you in 
error, please reply to this e-mail and highlight the error. No action 
should be taken regarding content, nor must you copy or show them to anyone.

This e-mail has been created in the knowledge that Internet e-mail is 
not a 100% secure communications medium, and we have taken steps to 
ensure that this e-mail and attachments are free from any virus. We must 
advise that in keeping with good computing practice the recipient should 
ensure they are completely virus free, and that you understand and 
observe the lack of security when e-mailing us.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: phill.vcf
Type: text/x-vcard
Size: 272 bytes
Desc: not available
URL: <>

More information about the nginx mailing list