Hi all,
I recently experiencing the problem on my local after i installed the zend server a few days before. But due to this problem i uninstalled the zend server and my drupal site is working fine but drush is showing this error:

Macbook-Air:drupal7 apple$ drush cc

Command cache-clear needs a higher bootstrap level to run - you will need invoke drush from a more functional Drupal environment to run this command.                                            [error]
The drush command 'cc' could not be executed.                                                                                                                                                    [error]
Drush was not able to start (bootstrap) the Drupal database.                                                                                                                                     [error]
Hint: This error often occurs when Drush is trying to bootstrap a site that has not been installed or does not have a configured database.

Drush was attempting to connect to : 
  Drupal version    : 7.12
  Site URI          : http://default
  Database driver   : mysql
  Database hostname : 127.0.0.1
  Database username : root
  Database name     : new_drupal
  Default theme     : garland
  Administration theme: garland
  PHP configuration : 
  Drush version     : 4.5
  Drush configuration: 
  Drush alias files : 
  Drupal root       : /Users/apple/Sites/drupal7
  Site path         : sites/default
  Modules path      : sites/all/modules
  Themes path       : sites/all/themes
  File directory path: sites/default/files
  %paths            : Array

I enquired about the php config file :

Macbook-Air:drupal7 apple$ which php
/opt/local/bin/php

Macbook-Air:drupal7 apple$ whereis php
/usr/bin/php

Macbook-Air:drupal7 apple$ type -a php
php is /opt/local/bin/php
php is /usr/bin/php

As referenced in this issue: http://drupal.org/node/1393232

I think drush is not able to load php configuration file. How to force drush to use the same config file as my drupal installation.
Any Help would be great ???

Comments

Amit Dwivedi’s picture

Issue summary: View changes

Link to another related issue is added as a reference.

techgirlgeek’s picture

I'm having this exact issue since trying to upgrade to drush 7.x-5.
The drush that comes installed with the Acquia Dev desktop seems to work, but that cannot be updated easily to the current release. I've done brand new git pulls of the drush repository, and continue to get the same error.
I've even tried to use the --php option when running drush, still no luck.

Thoughts?

techgirlgeek’s picture

My error:

Command pm-list needs a higher bootstrap level to run - you will need invoke drush from a more functional Drupal environment [error]
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 error often occurs when Drush is trying to bootstrap a site that has not been installed or does not have a
configured database.

Drush was attempting to connect to : 
  Drupal version    : 8.0-dev
  Site URI          : http://sprintdrupal8
  Database driver   : mysql
  Database hostname : 127.0.0.1
  Database username : drupaluser
  Database name     : d8test
  Default theme     : garland
  Administration theme: garland
  PHP configuration : 
  Drush version     : 5.0
  Drush configuration: 
  Drupal root       : /Users/karyncassio/testSites/drupal8
  Site path         : sites/sprintdrupal8
  Modules path      : sites/all/modules
  Themes path       : sites/all/themes
  File directory path: sites/sprintdrupal8/files
  %paths            : Array

You can select another site with a working database setup by specifying the URI to use with the --uri parameter on the
command line or $options['uri'] in your drushrc.php file.
techgirlgeek’s picture

After following the different threads about this issue, I realized that my system seems to be getting confused between the Mac installed version of PHP, which has the executable running out of /opt/local/bin, and the PHP installed with either XAMPP or in my case Acquia Dev enviroment/DAMP.

I went to /opt/local/bin and sudo mv php php.bak.
Edited my ~/.profile file to make sure only the currently in use version of PHP is in the path.

This now uses the correct version of php and finds the php.ini path needed, and shows in the PHP Configuration line in the status information.

~/Sites/drush.5/drush --uri=http://sprintdrupal8 status
 Drupal version         :  8.0-dev                                        
 Site URI               :  http://sprintdrupal8                           
 Database driver        :  mysql                                          
 Database hostname      :  127.0.0.1                                      
 Database username      :  drupaluser                                     
 Database name          :  d8test                                         
 Database               :  Connected                                      
 Drupal bootstrap       :  Successful                                     
 Drupal user            :  Anonymous                                      
 Default theme          :  bartik                                         
 Administration theme   :  seven                                          
 PHP configuration      :  /Applications/acquia-drupal/php5_3/bin/php.ini 
 Drush version          :  5.0                                            
 Drush configuration    :                                                 
 Drupal root            :  /Users/karyncassio/testSites/drupal8           
 Site path              :  sites/sprintdrupal8                            
 File directory path    :  sites/sprintdrupal8/files
jorgensean’s picture

[#3] started me on the right path, but I still couldn't get drush to bootstrap -

I'm using Acquia Dev Desktop, and the php version for my site is 5.2.17, however, drush was still trying to bootstrap with 5.3.9

Command pm-list needs a higher bootstrap level to run - you will need invoke drush from a more functional Drupal environment [error] 
etc etc

Drupal version         :  7.12                                             
 Site URI               :  xxxx                                        
 Default theme          :  garland                                          
 Administration theme   :  garland                                          
 PHP configuration      :  /Applications/acquia-drupal/php5_3/bin/php.ini   
 Drush version          :  5.0-dev                                          
 Drush configuration    :                                                   
 Drush alias files      :  /Users/seanj/.drush/xxxx.aliases.drushrc.php 
 Drupal root            :  /Users/seanj/Sites/seanj/docroot                 
 Site path              :  sites/xxxx                                 
 File directory path    :  sites/xxxx/files 

However, with some ~/.bash_profile (not ~/.profile) tweaking, I seem to have got it-

export PATH="$PATH:/Applications/acquia-drupal/php5_2/bin:/usr/local/bin"
alias drush='/Applications/acquia-drupal/php5_2/bin/php /Applications/acquia-drupal/drush/drush.php'

Note: the alias is the important one, the path just makes it so php 5.2 is the default command line version (note, I also renamed /usr/bin/php to /usr/bin/phpbak) of php.

Thanks for getting me started on the right path!

Drupal version         :  7.12                                             
 Site URI               :  xxxx                                        
 Database driver        :  mysql                                            
 Database hostname      :  127.0.0.1                                        
 Database username      :  drupaluser                                       
 Database name          :  xxxx                                         
 Database               :  Connected                                        
 Drupal bootstrap       :  Successful                                       
 Drupal user            :  Anonymous                                        
 Default theme          :  bartik                                           
 Administration theme   :  seven                                            
 PHP configuration      :  /Applications/acquia-drupal/php5_2/bin/php.ini   
 Drush version          :  5.0-dev                                          
 Drush configuration    :                                                   
 Drush alias files      :  /Users/seanj/.drush/xxxx.aliases.drushrc.php 
 Drupal root            :  /Users/seanj/Sites/seanj/docroot                 
 Site path              :  sites/dev.learn                                  
 File directory path    :  sites/dev.learn/files   
Amit Dwivedi’s picture

Status: Active » Fixed

As i suspected drush was not able to get the correct php.ini file.
Thanks to techgirlgeek's (#3) advise -

Move the php to php.bak:

  cd /opt/local/bin
    sudo mv php php.bak

Now Drush is using correct php.ini file.

Macbook-Air:drupal7 apple$ drush status
 Drupal version         :  7.9                        
 Site URI               :  http://default             
 Database driver        :  mysql                      
 Database hostname      :  127.0.0.1                  
 Database username      :  root                       
 Database name          :  drupal7                    
 Database               :  Connected                  
 Drupal bootstrap       :  Successful                 
 Drupal user            :  Anonymous                  
 Default theme          :  bartik                     
 Administration theme   :  seven                      
 PHP configuration      :  /private/etc/php.ini       
 Drush version          :  4.5                        
 Drush configuration    :                             
 Drush alias files      :                             
 Drupal root            :  /Users/apple/Sites/drupal7 
 Site path              :  sites/default              
 File directory path    :  sites/default/files
Amit Dwivedi’s picture

Status: Fixed » Closed (fixed)

fixed and closed.

Amit Dwivedi’s picture

Issue summary: View changes

corrected typo!

jschoen’s picture

Thanks so much! I spent a long time Googling this. I was getting the following errors when trying create a new subtheme using Omega 4 and Drush and #4 was the perfect solution. I to am using Acquia Dev Desktop. I have a feeling others will be looking for this also so I hope this helps!

The drush command 'owiz' could not be found.  Run `drush cache-clear [error]
drush` to clear the commandfile cache if you have installed new
extensions.
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.26                           
 Site URI               :  http://default                 
 Database driver        :  mysql                          
 Database username      :  drupaluser                     
 Database name          :  omegasand                      
 PHP executable         :  /usr/bin/php                   
 PHP configuration      :  /private/etc/php.ini           
 PHP OS                 :  Darwin                         
 Drush version          :  7.0-dev                        
 Drush temp directory   :  /tmp                           
 Drush configuration    :                                 
 Drush alias files      :                                 
 Drupal root            :  /Users/jschoen/sites/omegasand 
 Site path              :  sites/default  
tahiche’s picture

I know this is stupid, but...
I downloaded the example.drushrc.php file, renamed it to drushrc.php and placed it in sites/all foder.
Creared Drush cache, but "Drush configuration" info was still blank, no sign of my drushrc.php file.
The example.drushrc.php is totally commented out (logical) as soon as i added a no-comment $options[] it showed up!!.
Seems like since there was nothing to read Drush didn´t bother to point to that location.

bwoods’s picture

For whatever reason on a fresh install, mysql wasn't able to be loaded. I had to manually add to my path. I found details here - http://www.webbykat.com/2012/06/solving-sh-mysql-command-not-found-mamp-... .