Connecting Tech Pros Worldwide Forums | Help | Site Map

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

Newbie
 
Join Date: Feb 2008
Posts: 1
#1: Feb 21 '08
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):

<?php
try {
$dbname = "dbName";
$username = "MACHINENAME\\IUSR_JCOMP";
$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";
exit;
}

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

$dbh = null;
?>

I receive the following result:

John|Smith
Bill|Jones
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?

pbmods's Avatar
Site Moderator
 
Join Date: Apr 2007
Location: Texas
Posts: 5,435
#2: Jun 27 '08

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


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:
Quote:

Originally Posted by William Reed

Ok what you have to do is this, go to your PHP install directory and rename libmysql.dll to libmysql.old.

Next head to http://www.php.net/releases/ 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.

Reply