By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
463,075 Members | 690 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 463,075 IT Pros & Developers. It's quick & easy.

PDO and ODBC results in "Error in my_thread_global_end(): 5 threads didn't exit"

P: 1
Web Server: IIS6
PHP Version: 5.2.5
Database: MS SQLEXPRESS 2005
Loaded PDO Drivers: MSSQL, MySQL, ODBC

When executing the following script ($dbName, $username, $pw, $myDSN have been changed in this post to prevent access to my test environment):

try {
$dbname = "dbName";
$pw = "";
$myDSN = "msTestDSN";
$dbh = new PDO("odbc:dsn=$myDSN;uid=$username;pwd=$pw");
} catch (PDOException $e) {
echo "Failed to get DB handle: " . $e->getMessage() . "\n";

$query = "select * from d_users";
foreach ($dbh->query($query) as $row) {
print $row['fname'] . "|" . $row['lname'] . "<br />";

$dbh = null;

I receive the following result:

Error in my_thread_global_end(): 5 threads didn't exit

The first name/last name data pairs displayed are correct; however, nothing I do eliminates the error. I have disabled persistent connections eventhough according to the comments they are disabled by default on IIS. This message only occurs when I make a database connection. I don't get it by executing a non-database interactive page.

Has anybody seen this before? Can anybody help get rid of this error?
Feb 21 '08 #1
Share this Question
Share on Google+
1 Reply

Expert 5K+
P: 5,821
Heya, Roger.

This was a known bug in version 5.2.2. The solution was to copy the MySQL .dll file from the 5.2.1 distro to your 5.2.2 installation.

I don't know if/how this affects 5.2.5.

According to a post on the MySQL forum:
Ok what you have to do is this, go to your PHP install directory and rename libmysql.dll to libmysql.old.

Next head to and grab 5.2.1 Windows Binary download, just open the zip. Once open copy libmysql.dll to your php directory.

That should do the trick, it just worked fine for me.
Jun 27 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.