1
votes

Trying to install my first drupal module. Following the book did not work because of an "FTP" error so I installed drush. Download seemed to work now the enable command gives me this error. I'm a noob with ubuntu and every part of drupal. Help. Thanks.


NNH@comp:/var/www/drupal$ sudo drush en module_filter    
Command pm-enable needs a higher bootstrap level to run - you will   [error]    
need invoke drush from a more functional Drupal environment to run    
this command.    
The drush command 'en module_filter' could not be executed.          [error]    
Drush was not able to start (bootstrap) the Drupal database.         [error]    
Hint: This error often occurs when Drush is trying to bootstrap a    
site that has not been installed or does not have a configured    
database.and tried it.    

Drush was attempting to connect to :     
  Drupal version    : 7.14    
  Site URI          : http: //default    
  Database driver   : mysql    
  Database hostname : localhost    
  Database username : drupal7    
  Database name     : drupal7     
  Default theme     : garland    
  Administration theme: garland    
  PHP configuration :     
  Drush version     : 5.3    
  Drush configuration:     
  Drupal root       : /var/www/drupal    
  Site path         : sites/default    
  Modules path      : sites/all/modules    
  Themes path       : sites/all/themes    
  File directory path: sites/default/files    
  %paths            : Array    

You can select another site with a working database setup by    
specifying the URI to use with the --uri parameter on the command    
line or $options['uri'] in your drushrc.php file.    

Possibly related:

NNH@comp:~$ sudo dpkg-reconfigure -plow phpmyadmin     
[sudo] password for NNH:     
/usr/sbin/dpkg-reconfigure: phpmyadmin is broken or not fully installed    
2

2 Answers

2
votes

Drush is basically a command-line interface to interact, manage and configure Drupal and its modules. So if you like to use Drush for any operations pertaining database, you have to go through loop address ie., localhost. But it seems like Drush understands 127.0.0.1 as loop address but not localhost.

Simply by defining these in settings.php you are allowing the Drush to proceed with any database related operations.

Instead of just this

'host' => 'localhost',

use this,

'host' => php_sapi_name() == 'cli' ? '127.0.0.1' : 'localhost',
1
votes

You typically recieve the error

Command pm-enable needs a higher bootstrap level to run - you will [error] need invoke drush from a more functional Drupal environment to run this command.

when you aren't in the root of the site when running the command.

If the error persist try connecting to MySQL straight from the prompt. Try connecting using the values from the Drush output, ie:

mysql -hlocalhost -udrupal7 -p drupal7 

If it is working and the site is working then you most likely can rule out database connection problem. Assuming you are developing locally on your own box, you can try changing localhost to 127.0.0.1 in settings.php. This seem to have helped some people.

The site URI setting seems a bit odd.