I've got a preforking Apache server at work that's not sharing enough memory among the many children. This snippet helped identify post-fork module loading. I put an @INC hook at the end of my httpd.conf and it writes a warning to my log whenever the forked child loads something.
# httpd.conf ...# This fragment goes at the end, when I think I'm ready to let Apache start forking $main::PARENT_PID = $$; unshift @INC, sub { print STDERR "LATE LOAD: $_[1]\n" if $$ != $main::PARENT_PID; return undef; };
# httpd.conf LoadModule XML::LibXML LoadModule LWP::UserAgent ...
Rather than stuff everything into the Apache config, we ended up making an
package Foo::All;
use Apache::Constant ();
use XML::LibXML ();
etc...
etc...
Re:mod_perl required?
jjore on 2009-08-24T20:04:12
Probably applies to FCGI but not generalized CGI.