|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19946 ODBC fails to close connections
Submitted: 2002-10-17 01:34 UTC Modified: 2002-10-17 08:11 UTC
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: harold at worby dot dns2go dot com Assigned:
Status: Not a bug Package: ODBC related
PHP Version: 4.2.1 OS: Red Har 7.3
Private report: No CVE-ID: None
 [2002-10-17 01:34 UTC] harold at worby dot dns2go dot com
I'm using PHP 4.2.1 with unixODBC and FreeTDS to connect to MSSQL 7.0 and MSSQL 2000 servers. I have a problem with the database connection not being closed by PHP. I've tried combinations of odbc_connect, odbc_pconnect, odbc_close, odbc_close_all, and not calling any close function. ( the documentation claims the connection will close automaticaly when the script terminates )
All combinations I've tried leave an open connection on the server.
If I use the 'isql' program, again with unixODBC and FreeTDS, I do not have this problem.
I've had the same problem on RH7.0 and RH7.3 and with PHP 4.0 to 4.1.2.
                         What's Up?
Further investgation with Ethereal and netstat show after PHP excutes an odbc_exec() PHP receives the data then never sends anither packet to the sever leaving the socket in an ESTABLISHED state.
Neither odbc_close() nor odbc_close_all() send any packets.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-10-17 08:11 UTC]
What you are seeing is how ODBC works.  This really really isn't a bug in PHP, but rather from the sounds of it a bug in your ODBC driver.  

Turn on SQL logging and you should see the SQLDisconnect call, at which point PHP no longer has any idea of any connection... it's done with them.  All actual connections are handled by the ODBC driver, PHP just asks the driver to make a connection and process it using ABC options.
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Tue May 17 15:03:34 2022 UTC