2

I am setting up a new development environment on a local machine and am using AMPPS. I have installed Drush using Homebrew and am running a Mac (OS X 10.12.5 Sierra).

I have successfully installed a fresh Drupal site in my development environment. When I attempt to run a drush command, I get the Drush status along with the classic bootstrap/jailed shell message:

Command pm-list needs a higher bootstrap level to run - you will need to invoke drush from a more functional Drupal[error]
environment to run this command.
The drush command 'pm-list' 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.

Here is the output of drush status:

Drush was attempting to connect to: 
 Drupal version         :  7.54                                             
 Site URI               :  http://default                                   
 Database driver        :  mysql                                            
 Database hostname      :  localhost                                        
 Database port          :                                                   
 Database username      :  myuser                                            
 Database name          :  drupal                                           
 PHP executable         :  /Applications/AMPPS/php-5.6/bin/php              
 PHP configuration      :  /Applications/AMPPS/php-5.6/etc/php.ini          
 PHP OS                 :  Darwin                                           
 Drush script           :  /usr/local/Cellar/drush/8.1.15/libexec/drush.php 
 Drush version          :  8.1.15                                           
 Drush temp directory   :  /tmp                                             
 Drush configuration    :                                                   
 Drush alias files      :                                                   
 Drupal root            :  /Applications/AMPPS/www/drupal/docroot       
 Drupal Settings File   :  sites/default/settings.php                       
 Site path              :  sites/default 

Please note:

  • I have tried changing localhost to 127.0.0.1 in sites/default/settings.php and restarting the server
  • I added the path to drush to php via export DRUSH_PHP=/Applications/AMPPS/php-5.6/bin/php
  • I am executing the command within the docroot of the drupal installation
  • I do not have a ~/.my.cnf file
  • symlink in /usr/local/bin for PHP goes to Homebrew's instead of AMPPS's but it's for version 7.1.10 and I'm using PHP 5.6

There are a lot of posts on this with slightly different details or environments and I'm having no luck deriving a solution from those so I thought I would post my issue with the specific scenario.

I mostly used these instructions: https://www.drupal.org/node/954766

2 Answers 2

3

Even though I did export the Drush PHP path, I had not added the link to AMPPS' mysql bin in .bash_profile. That solved my issue.

nano ~/.bash_profile
export PATH=$PATH:/Applications/AMPPS/mysql/bin
source ~/.bash_profile
0

You might need to specify the path to Drush

I had

export PHP_ID="php-5.6"

export PATH="/Applications/AMPPS/$PHP_ID/bin:/Applications/AMPPS/mysql/bin:/Users//.composer/vendor/bin/drush:$PATH"

there is good info here Stuck with Drush on OS X with AMPPS and Homebrew

1
  • Just an FYI, your answer is basically what I said and the link you provided goes to this page.
    – Christia
    Commented Apr 9, 2018 at 18:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.