Hi,

after upgrading to Drush-HEAD on FreeBSD here, I'm bumping into this

could not find driver                                                                                                           [warning]
Drush was not able to start (bootstrap) the Drupal database.                                                                    [error]

each time I try to do something with Drush. Also, there's

Drush was attempting to connect to :
  Drupal Root       : /path/to/druparoot
  Drupal version    : 6.10
  Site Path         : sites/mysite.com
  Site URI          : http://www.mysite.com
  Database Driver   : mysqli
  Database Hostname : localhost
  Database Username : mysql_user
  Database Name     : drupal_database
  Database Name     : mypassword

Cheers,
Nico

Comments

adrian’s picture

This is related to the new PDO based db credential test we do.


    $type = ($creds['driver'] == 'mysqli') ? 'mysql' : $creds['driver'];
    $constr = sprintf("%s:dbname=%s;host=%s", $type, $creds['name'], $creds['host']);

    try {
      $db = new PDO($constr, $creds['user'], $creds['pass']);
      $db = null;
      return TRUE;
    }
    catch (PDOException $e) {
      // We do not use drush_set_error here , because it's up to the calling function
      // to determine whether or not this is an error or a warning.
      drush_log($e->getMessage(), 'warning');
      return FALSE;
    }

Which version of php are you using, and could you please do a phpinfo(); and check if you have
the mysql driver for PDO.

Moya:hosting adrian$ php -r 'phpinfo();'
---- snip ---
PDO

PDO support => enabled
PDO drivers => sqlite2, sqlite, pgsql, mysql
---- snip ----
adrian’s picture

Keep in mind. Drupal 7 will also not work if you don't have the necessary PDO driver (mysql)

adrian’s picture

Status: Active » Fixed

I added in a test for the driver availability. This avoids the test, but this also removes a layer of protection from drupal messing things up.

dennys’s picture

I have this question too and I think my PDO is enabled (from phpinfo()). My php is 5.2.9 and I just download newest version. Any suggestion for it? thanks.

PDO support enabled
PDO drivers sqlite, pgsql, mysql, sqlite2

nschloe’s picture

Okay, I installed PDO now, phpinfo() says

PDO
PDO support	enabled
PDO drivers 	sqlite, mysql 

and

pdo_mysql
PDO Driver for MySQL, client library version	5.0.75

The boostrap error does indeed disappear! :)

The next error I bumped into is

Drush bootstrap phase : _drush_bootstrap_drupal_root()              [bootstrap]
Initialized Drupal 6.10 root directory at /my/drupal/root/          [notice]
Drush bootstrap phase : _drush_bootstrap_drupal_site()              [bootstrap]
Initialized Drupal site www.mysite.com sites/mysite.com             [notice]
Drush bootstrap phase : _drush_bootstrap_drupal_configuration()     [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_database()          [bootstrap]
Successfully connected to the Drupal database.                      [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_full()              [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_login()             [bootstrap]
The command 'drush.php pm update' could not be executed.            [error]

:( I'm not challenged for a user password at all, might that be the reason?

moshe weitzman’s picture

there is no command `pm update` anymore. you want `updatecode` or `update`. please run `drush help` to review the list of commands. Names have changed.

nschloe’s picture

Oh gosh, that's right, sorry for the noise.

It would possibly be useful to give some error message about that, like `drush: unrecognized option 'pm update'`, and then the output of `drush help` or something like that.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.