2

Do you have any idea on what might be causing this error in Drush w/ Drupal 7.2 (worked fine in Drupal 7.0)?

Fatal error: Undefined class constant 'MYSQL_ATTR_USE_BUFFERED_QUERY' in /path/to/includes/database/mysql/database.inc on line 42
Drush command terminated abnormally due to an unrecoverable error. [error] Error: Undefined class constant 'MYSQL_ATTR_USE_BUFFERED_QUERY' in /path/to/includes/database/mysql/database.inc, line 42

Line 42 of database.inc contains the following line:

PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => TRUE,

I thought this was related to PDO extension missing, but it is indeed installed.

Here is the output of drush -v -d status:

drush -d -v status
Bootstrap to phase 0. [0.03 sec, 1.28 MB] [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drush() [0.03 sec, 1.41 MB] [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_root() [0.07 sec, 3.18 MB] [bootstrap]
Initialized Drupal 7.2 root directory at /path/to [0.09 sec, 4.06 MB] [notice]
Drush bootstrap phase : _drush_bootstrap_drupal_site() [0.09 sec, 4.06 MB] [bootstrap]
Initialized Drupal site default at sites/default [0.09 sec, 4.06 MB] [notice]
Drush bootstrap phase : _drush_bootstrap_drupal_configuration() [0.09 sec, 4.06 MB] [bootstrap]

Fatal error: Undefined class constant 'MYSQL_ATTR_USE_BUFFERED_QUERY' in /path/to/includes/database/mysql/database.inc on line 42
Drush command terminated abnormally due to an unrecoverable error.                                                                                                                    [error]
Error: Undefined class constant 'MYSQL_ATTR_USE_BUFFERED_QUERY' in /path/to/includes/database/mysql/database.inc, line 42 [0.1 sec, 4.56 MB]

EDIT:

phpinfo indicates that pdo, pdo_mysql are all installed. However, when I run

pecl remote-info pdo (and pdo-mysql), I get a (among others):

Installed - no -

So it appears that via the web requests, the extensions appear as installed, but not from the command line (same instance of php, v5.3). Is there a way to tell pecl what phpinfo already knows ... ?

4

Ok, another one for the "learning experience" column:

I specified

DRUSH_PHP=/path/to/php

right before this line in drush wrapper script:

if [ ! -z "$DRUSH_PHP" ] ; then

Works now.

Thanks @kiamlaluno & @Berdir for your time and input. Hopefully this helps others.

KM

  • 1
    Sounds like you have multiple PHP versions installed, then... – Berdir Jun 1 '11 at 22:58
  • Yeah @Berdir, found that out after I opened the wrapper script. It runs a check using "which php", which was still pointing to an older version of php. When I ran php -m and pecl I was using the current version. Thanks again! (-: – KM. Jun 2 '11 at 1:09
3

You are most likely missing the pdo_mysql extension, which you also not, not only pdo and mysql/mysqli (that one is actually not necessary for Drupal 7, but is if you're also using Drupal 6 or other projects which use it).

You can see the enabled modules with:

php -m

Make sure it lists both PDO and PDO_mysql and if not, enable/install that.

  • Thanks @Berdir. I tried that and I get these: PDO,pdo_mysql,pdo_pgsql,pdo_sqlite. Any ideas? – KM. May 31 '11 at 19:07
1

There is an issue report on Drupal.org, Fatal error in D7 HEAD while running 'drush update', where the OP reports a similar error.
One user reports the error can be fixed when the php_pdo_mysql extension is installed; another user reports it is necessary to install php5-mysql, under Ubuntu 10.10.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.