diff -x '*~' -ruN Apache-DBI-1.05.orig/lib/Apache/DBI.pm Apache-DBI-1.05/lib/Apache/DBI.pm
--- Apache-DBI-1.05.orig/lib/Apache/DBI.pm	2006-11-03 23:17:44.000000000 -0700
+++ Apache-DBI-1.05/lib/Apache/DBI.pm	2008-03-12 17:38:37.455592048 -0600
@@ -137,7 +137,7 @@
     # script has finished if AutoCommit is off.  however, cleanup can only
     # be determined at end of handle life as begin_work may have been called
     # to temporarily turn off AutoCommit.
-    if (!$Rollback{$Idx} and Apache->can('push_handlers')) {
+    if (!$Rollback{$Idx} and (Apache->can('push_handlers') || MP2)) {
         debug(2, "$prefix push PerlCleanupHandler");
         if (MP2) {
             my $s = Apache2::ServerUtil->server;
@@ -151,6 +151,17 @@
         $Rollback{$Idx} = 1;
     }
 
+    if (Apache->can('push_handlers') || MP2) {
+        debug(2, "$prefix push PerlChildExitHandler");
+        if (MP2) {
+            my $s = Apache2::ServerUtil->server;
+            $s->push_handlers("PerlChildExitHandler", sub { child_disconnect($Idx) });
+        }
+        else {
+            Apache->push_handlers("PerlChildExitHandler", sub { child_disconnect($Idx) });
+        }
+    }
+
     # do we need to ping the database ?
     $PingTimeOut{$dsn}  = 0 unless $PingTimeOut{$dsn};
     $LastPingTime{$dsn} = 0 unless $LastPingTime{$dsn};
@@ -236,6 +247,26 @@
     1;
 }
 
+sub child_disconnect {
+    my $Idx = shift;
+    
+    my $prefix = "$$ Apache::DBI            ";
+    debug(2, "$prefix PerlChildExitHandler");
+
+    if ($Connected{$Idx}) {
+        cleanup($Idx);
+
+        {
+            package Apache::DBI::db;
+            eval { $Connected{$Idx}->SUPER::disconnect(); };
+            delete $Connected{$Idx}
+        }
+        debug(2, "$prefix PerlChildExitHandler disconnect for '$Idx'");
+    }
+
+    1;
+}
+
 # Store the default start state of each dbh in the handle
 # Note: This uses private_Apache_DBI hash ref to store it in the handle itself
 my @attrs = qw(
