Custom PHP session handler (MS SQL) and register_shutdown_function()?]

From: Date: Thu, 14 Aug 2003 17:48:53 +0000
Subject: Custom PHP session handler (MS SQL) and register_shutdown_function()?]
Groups: php.internals 
Request: Send a blank email to internals+get-3945@lists.php.net to get a copy of this message
-------- 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


« previous php.internals (#3945) next »