Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:3945 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 67939 invoked from network); 14 Aug 2003 17:49:00 -0000 Received: from unknown (HELO localhost.localdomain) (165.206.47.34) by pb1.pair.com with SMTP; 14 Aug 2003 17:49:00 -0000 Received: from tonybibbs.com (localhost [127.0.0.1]) by localhost.localdomain (8.12.8/8.12.8) with ESMTP id h7EHmsYI016542 for ; Thu, 14 Aug 2003 12:48:54 -0500 Message-ID: <3F3BCB85.90706@tonybibbs.com> Date: Thu, 14 Aug 2003 12:48:53 -0500 User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624 X-Accept-Language: en-us, en MIME-Version: 1.0 To: internals@lists.php.net Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Subject: Custom PHP session handler (MS SQL) and register_shutdown_function()?] From: tony@tonybibbs.com (Tony Bibbs) -------- Original Message -------- Subject: RE: Custom PHP session handler (MS SQL) and register_shutdown_function()? Date: Thu, 14 Aug 2003 17:12:41 +0100 From: James Cox To: 'Tony Bibbs' The list is now internals@lists.php.net ... > -----Original Message----- > From: Tony Bibbs [mailto:tony@tonybibbs.com] > Sent: Thursday, August 14, 2003 3:32 PM > To: php-dev@lists.php.net > Subject: Custom PHP session handler (MS SQL) and > register_shutdown_function()? > > > I just spend quite a few hours tracking down an issue that I > thought was > with my custom session handler (uses MS SQL Server 2000 via PEAR::DB) > but it turns out it was related to register_shutdown_function. > > We have a simple script called db_init.php that has two functions, > doConnect() and doDisconnect(). We called > register_shutdown_function('doDisconnect') but apparrently this is > called before ending the user session which, as you might > guess, kills > my database connection and prevents my session write function from > working. My hunch is that this is working as designed but I > wanted to > make sure. If so, my next guess is you all will probably > recommend that > I call doDisconnect() from my session close method instead of using > register_shutdown_function, right? > > Finally, in troubleshooting this, I learned that if your > connection dies > before you do the session write using MS SQL Server 2000, it kills an > apache child process and you get no response back. Using the same > scenario with *MySQL* at least the mysql driver returns gracefully. I > know this is a bit obscure but, in my opinion the mssql driver should > work the same way (if possible) otherwise debugging is a real PITA. > > I'm willing to provide sample code if needed. > > --Tony > >