【问题标题】:bootstrap error trying to enable drupal module with drush尝试使用 drush 启用 drupal 模块的引导错误
【发布时间】:2012-06-08 15:15:03
【问题描述】:

尝试安装我的第一个 drupal 模块。由于“FTP”错误,这本书没有奏效,所以我安装了 drush。现在下载似乎可以工作了,启用命令给了我这个错误。我是 ubuntu 和 drupal 各个部分的菜鸟。帮助。谢谢。


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.    

可能相关:

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

【问题讨论】:

    标签: mysql drupal ubuntu drush


    【解决方案1】:

    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',
    

    【讨论】:

      【解决方案2】:

      您通常会收到错误提示

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

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

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

      mysql -hlocalhost -udrupal7 -p drupal7 
      

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

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

      【讨论】:

      • 试过 "/var/www/drupal/sites/default$ sudo drush en module_filter" 得到同样的错误。那会是网站的根吗?下载命令似乎很高兴从 /var/www/drupal 运行。将尝试连接 mysql,必须查找命令。
      • 在这种情况下,站点的根目录是 /var/www/drupal,所以您似乎从一开始就处于正确的位置。我假设你有 /var/www/drupal/sites/default/settings.php。
      猜你喜欢
      • 2015-05-29
      • 2014-10-22
      • 2021-08-16
      • 1970-01-01
      • 1970-01-01
      • 2016-03-10
      • 2010-09-14
      • 2019-07-01
      • 2011-07-10
      相关资源
      最近更新 更多