2016-01-12 68 views
0

當'localhost'在我的設置中時,我無法使用'drush status'。如果我切換到「127.0.0.1」,Drush狀態有效,但沒有正確連接;給端口添加掛起它。我使用的是MAMP Pro 3,它更喜歡'localhost'和端口8889.如果我使用IP版本,MAMP拋出一個PDO異常(或超時,取決於我是否添加一個端口)。Drush 7與'localhost'無效

如何配置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

找到我自己的答案。這個錯誤與使用不同版本的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"