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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Roger Trask
    New Member
    • Feb 2008
    • 1

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

    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\\I USR_JCOMP";
    $pw = "";
    $myDSN = "msTestDSN" ;
    $dbh = new PDO("odbc:dsn=$ myDSN;uid=$user name;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_globa l_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
    Recognized Expert Expert
    • Apr 2007
    • 5821

    #2
    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:
    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.

    Comment

    Working...