I'm stil battling the problem with Apache. I've been paring down our installation to the bare essentials to try to isolate what the problem component is. I've turned off all unnecessary PHP extensions, unloaded all unused Apache modules, and completely uninstlled mod_auth_pgsql because it no longer supports FreeBSD.
I've upgraded PHP on quark and quarkprime.
The procedure I used was this
# portupgrade -ri --yes -f php4
which upgrades php4 and everything that depends on it.
I've upgraded Apache on quark and quarkprime to 1.3.33, and also enabled suExec support.
Getting suExec working was as simple as setting the minimum UID and GID to run the scripts as, and setting the proper web user.
I've finally gotten a test-bed TWiki installation running on quark. Right now, I've got a Sysadmin web, with key schedule and server information topics. I've still got to get a better authentication scheme working though.
In response to this message, I poked around on the FreeBSD lists, and found this message. It seems to address the problem that we are having with Apache running out of memory.
The message on the list archive suggested only giving multiple restart signals to Apache. To address that, I took half of our restart signals out, so Apache only restarts when rotating the error logs of a domain.