【问题标题】:My drush doen't run commands to database (apache)我的迷恋不向数据库运行命令(apache)
【发布时间】:2016-05-01 23:56:42
【问题描述】:

我已经在我的 Mac(El Capitan) 上的 apache 中设置了虚拟主机。我所有的项目都位于我的用户/我的名字/站点中,并且我安装了 Drush。我可以使用 drush 下载 stuf,例如:drush dl drupal。但是当我尝试使用 drush 启用模块时,我得到以下信息:

Command pm-enable needs a higher bootstrap level to run - you will [error]
need to invoke drush from a more functional Drupal environment to run
this command.
The drush command 'en admin_toolbar' 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.41                                      
Site URI              :  http://default                            
Database driver       :  mysql                                     
Database hostname     :  localhost                                 
Database port         :                                            
Database username     :  root                                      
Database name         :  MyDatabase                                 
PHP executable        :  /usr/bin/php                              
PHP configuration     :                                            
PHP OS                :  Darwin                                    
Drush script          :  /Users/kim/.composer/vendor/drush/drush/drush.php                                  
Drush version         :  8.1-dev                                   
Drush temp directory  :  /tmp                                                          
Drush configuration   :                                            
Drush alias files     :                                            
Drupal root           :  /Users/MyName/Sites/MyProject                          
Site path             :  sites/default

我的猜测是我的 drush 没有正确配置到我的数据库设置,但我不知道如何解决这个问题,或者这是否是真正的问题。如果有人可以帮助我,那就太好了!

【问题讨论】:

标签: apache drupal osx-elcapitan drush


【解决方案1】:

我最近遇到了类似的错误。事实证明,我需要将 mysql 添加到系统路径中,这是通过将下面的行添加到我的 .bash_profile 来完成的。我正在使用 MAMP,因此您可能需要调整设置路径。

导出 PATH=$PATH:/Applications/MAMP/Library/bin/

【讨论】:

  • 我以前也运行 MAMP,但现在我只使用 apache。我需要定义另一条路径,但我不知道是哪一条...
【解决方案2】:

我自己修复了,对于 apache,.bash_profile 中的路径是

export PATH="/usr/local/mysql/bin:$PATH"

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-05-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多