0

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

我的默认外壳是 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
4

3 回答 3

3

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

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

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

对我来说效果很好。

于 2013-10-15T14:38:00.257 回答
1

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

于 2013-05-10T17:55:59.247 回答
0

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

sudo ln -s /Applications/XAMPP/xamppfiles/var/mysql /var/mysql
于 2013-12-30T13:34:42.927 回答