Drush 7不适用于'localhost'

时间:2016-01-12 22:37:52

标签: mamp-pro drush

当'localhost'在我的设置中时,我无法使用'drush status'。如果我切换到'127.0.0.1',Drush状态有效,但没有正确连接;一个端口挂起它。我正在使用MAMP Pro 3,它更喜欢'localhost'和端口8889.如果我使用IP版本,MAMP会抛出PDO异常(或者超时,具体取决于我是否添加端口)。

如何配置MAMP 3以使用Drush?

除了MAMP版本,我的问题类似于Drush enable errorDrush install on local server error (Command pm-enable needs a higher bootstrap level)。我已经创建了那里推荐的符号链接,但我不确定MAMP是否使用/ var路径。

我的错误是:

    <h1>Additional uncaught exception thrown while handling exception.</h1>
    <h2>Original</h2><p>PDOException: SQLSTATE[HY000] [2002] No such file or directory in drupal_is_denied()
    (line 1921 of /Users/mypath/includes/bootstrap.inc).</p><h2>Additional</h2><p>PDOException: SQLSTATE[HY000] [2002]
    No such file or directory in _registry_check_code() (line 3194 of /Users/mypath/includes/bootstrap.inc).</p>
    <hr />Drush command terminated abnormally due to an unrecoverable error.
    [error]

1 个答案:

答案 0 :(得分:2)

找到我自己的答案。此错误与使用不同版本的PHP的MAMP有关。当我将$ PATH更改为指向正确的版本时,Drush开始正常工作。

步骤:

  1. 检查MAMP的phpinfo,找到它正在使用的PHP版本的路径。
  2. 使用类似的东西编辑.bash_profile(确保使用正确的PHP版本):

    export PATH="/Applications/MAMP/Library/bin:/Applications/MAMP/bin/php/php5.6.10/bin:$PATH"
    
相关问题