【问题标题】:Drush 7 does not work with 'localhost'Drush 7 不适用于“本地主机”
【发布时间】:2016-04-17 17:49:57
【问题描述】:

当“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]

【问题讨论】:

    标签: mamp-pro drush


    【解决方案1】:

    找到我自己的答案。此错误与使用不同版本的 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"
      

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-12-18
      • 1970-01-01
      • 1970-01-01
      • 2014-10-01
      • 2016-01-14
      • 2016-08-05
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多