Undefined symbol: php_pdo_declare_long_constant

After installing a new PDO module (PDO_PgSQL) into our compiled-from-the-ground-up version of PHP 5.2.8 (.. since RHEL4 doesn’t really stay updated, but we do), i ran head first into the following issue:

/usr/sbin/httpd: symbol lookup error: /usr/local/lib/php/extensions/no-debug-non-zts-20060613/pdo_pgsql.so: undefined symbol: php_pdo_declare_long_constant

Panic. Then tried updating pdo_mysql which actually still worked, which just led it to have the exact same problem. Luckily a bit of searching at Google pointed me to PDO_MYSQL causing Apache segfault over at the PECL bug tracker. The last comment provided the solution to the problem: a quick rebuild of PHP with –disable-pdo and then enabling pdo from PECL instead (so that PDO and the PDO plugins API actually match, instead of trying to load the wrong version into the process) solved the issue.

Be sure to build PDO from the SAME VERSION as your client libraries. Disable it in the PHP build itself if you need to build it from PECL.

One thought on “Undefined symbol: php_pdo_declare_long_constant”

  1. Thanks for pointing me in the right direction, but I think I found something important… According to the pecl PDO page, http://pecl.php.net/package/PDO, the pecl extension is discontinued because it’s been rolled into PHP’s source.

    Adding “–with-pdo-mysql=shared” to my configure, and then “extension=pdo_mysql.so” in php.ini was enough for me! This is PHP 5.2.6 on Zenwalk/Slackware…

Leave a Reply

Your email address will not be published. Required fields are marked *