【问题标题】:Command needs a higher bootstrap level to run命令需要更高的引导级别才能运行
【发布时间】:2013-03-17 18:24:02
【问题描述】:

我一直在寻找解决方案,但我只是没有找到它。我正在尝试在我的 MAMP 平台上使用 drush(我有 Leopard)。安装似乎很顺利,但是当我尝试使用它时出现错误。

我的默认 shell 是 tcsh。我创建了一个文件 .bash_profile 并在其中添加了“export PATH="/Applications/MAMP/Library/bin:/Applications/MAMP/bin/php5.3/bin:$PATH" 行。然后我更改为 bash shell并发送命令:drush en views_ui。 (我从 tcsh shell 得到同样的错误)

我是网站的根。

对不起,如果这是一个重复的问题。请帮忙...


bash-3.2$ drush en views_ui
Command pm-enable needs a higher bootstrap level to run - you will need to invoke drush from a more functional Drupal environment to  [error]
run this command.
The drush command 'en views_ui' could not be executed.                                                                                [error]
Drush was not able to start (bootstrap) the Drupal database.                                                                          [error]
Hint: This may occur when Drush is trying to:
 * bootstrap a site that has not been installed or does not have a configured database. In this case you can select another site with
a working database setup by specifying the URI to use with the --uri parameter on the command line. See `drush topic docs-aliases` for
details.
 * connect the database through a socket. The socket file may be wrong or the php-cli may have no access to it in a jailed shell. See
http://drupal.org/node/1428638 for details.

Drush was attempting to connect to: 
  Drupal version    : 7.0
  Site URI          : http://default
  Database driver   : mysql
  Database hostname : localhost
  Database username : root
  Database name     : d7dev
  Default theme     : garland
  Administration theme: garland
  PHP configuration : /private/etc/php.ini
  Drush version     : 5.8
  Drush configuration: 
  Drupal root       : /Applications/mamp/htdocs/d7dev
  Site path         : sites/default
  Modules path      : sites/all/modules
  Themes path       : sites/all/themes
  File directory path: sites/default/files
  %paths            : Array

【问题讨论】:

  • 只是一个简单的问题 - 执行命令时 MAMP 是否正在运行?似乎 drush 无法连接到数据库服务器。
  • 是的,mamp 正在运行(MAMP 窗口在那里...MySQL 服务器旁边的绿灯亮...我可以通过 localhost 连接到我的 drupal 站点...)
  • 您的 CLI 用户很可能没有 sites/default/settings.php 的读取权限
  • sudo chmod +r+w+x sites/default/settings.php ...同样的问题...还是我应该做其他事情? (感谢您的帮助)
  • 不应该在drupal.stackexchange.com问这个吗?

标签: drupal bootstrapping drush


【解决方案1】:

对于像我这样对 XAMPP 有同样问题的人来说,这篇文章是如何以某种方式结束的。以下代码行对我有用。确保你首先“cd”到你是 Drupal root。

sudo ln -s /Applications/XAMPP/xamppfiles/var/mysql /var/mysql

【讨论】:

    【解决方案2】:

    所以我知道这是一个旧的,但您是否尝试过https://drupal.org/node/1428638 的解决方案(上面的错误消息中提供的 URL)?

    结果是您应该在 settings.php 中更新您的数据库“主机”值:

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

    对我来说效果很好。

    【讨论】:

      【解决方案3】:

      我在本地开发人员上遇到了同样的问题(使用 XAMP 或 MAMP)。我所做的只是安装 php5-mysql 和 drush en 工作。

      【讨论】:

        猜你喜欢
        • 2015-04-02
        • 2014-07-18
        • 2013-03-25
        • 2021-02-15
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2022-06-22
        • 2021-12-14
        相关资源
        最近更新 更多