June 4, 2014, 12:36 p.m.
IT

Call to a member function query() on a non-object ... in pdo_driver.php

I recently tried to boot up an old PHP based project, but it failed with the error:

Call to a member function query() on a non-object ... in pdo_driver.php

Looking at phpinfo() output, I saw that --enable-pdo was present but so too --without-pdo-mysql. Since this project depended on PDO / MySQL, it was clear this was the culprit.

To fix this I had to add mysql in addition to pdo to my USE flags in /etc/portage/make.conf and emerge php as I was running Gentoo Linux.