1

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    
4

2 回答 2

2

Drush 基本上是一个命令行界面,用于交互、管理和配置 Drupal 及其模块。因此,如果您想将 Drush 用于任何与数据库相关的操作,您必须通过循环地址,即 localhost。但似乎 Drush 将127.0.0.1理解为循环地址而不是localhost

只需在 settings.php 中定义这些,您就可以让 Drush 继续进行任何与数据库相关的操作。

而不仅仅是这个

'host' => 'localhost',

用这个,

'host' => php_sapi_name() == 'cli' ? '127.0.0.1' : 'localhost',
于 2013-04-28T15:11:09.827 回答
1

您通常会收到错误

命令 pm-enable 需要更高的引导级别才能运行 - 您将 [错误] 需要从功能更强大的 Drupal 环境调用 drush 才能运行此命令。

当您在运行命令时不在站点的根目录中时。

如果错误仍然存​​在,请尝试直接从提示连接到 MySQL。尝试使用 Drush 输出中的值进行连接,即:

mysql -hlocalhost -udrupal7 -p drupal7 

如果它正在运行并且该站点正在运行,那么您很可能可以排除数据库连接问题。假设您在自己的机器上进行本地开发,您可以尝试在 settings.php 中将 localhost 更改为 127.0.0.1。这似乎帮助了一些人。

站点 URI 设置似乎有点奇怪。

于 2012-06-04T15:04:57.333 回答