我全神贯注地寻求解决方案,但我只是找不到它。我试图在我的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
答案 0 :(得分:3)
所以我知道这是一个旧的,但您是否尝试了https://drupal.org/node/1428638 的解决方案(上面的错误消息中提供的URL)?
结果是您应该使用以下命令更新settings.php中的数据库'host'值:
'host' => php_sapi_name() == 'cli' ? '127.0.0.1' : 'localhost',
对我来说很棒。
答案 1 :(得分:1)
我在本地设备上遇到了同样的问题(不使用XAMP或MAMP)。我所做的只是安装php5-mysql和drush en working。
答案 2 :(得分:0)
对于像我这样对XAMPP有同样问题的人来说,不知怎的,这篇文章最终会在这里结束。以下代码对我来说很有用。确保你首先“cd”到你的Drupal root。
sudo ln -s /Applications/XAMPP/xamppfiles/var/mysql /var/mysql