Wednesday, February 10, 2010

Bug PDO MySQL 5.0.67 (Linux only)

My configuration :

  • - CentOS 5 (same problem with RedHat)
  • - MySQL 5.0.67
  • - PHP 5.1.6
  • - PDO lib 5.0.67

I may encounter such fatal errors :

Fatal error: Call to a member function fetch() on a non-object...

It looks like the PDO Statement has been killed or doesn't respond... For the same processing, running on Windows, with MySQL 5.1.30 and PDO lib 5.0.51a, everything works...
When I execute code on Windows server, targetting database to my Linux server, it works well. So I can rely on MySQL server...
Using a mysql_connect() command also works, so I guess the problem comes from PDO libraries...

A very few people mentionned this issues on technical forums that's why I open this post to anyone who's been annoyed with it...

Updated on 2010-03-01

Here is a solution :

$queryTypRef = myQuery;
$stmtTypeRef = $this->_dbOps->query($queryTypRef);
$resTypeRef = $stmtTypeRef->fetch();

$stmtTypeRef = null;

No comments :

Post a Comment

Comments are moderated before being published.