I've been scouting the forums for the past two days trying to get an answer to my problem, i'm new to Drush but pretty good with Drupal. my environment is as follows:

  • centos 6
  • php 5.3.3
  • drupal 7.x single site basic installation

I've installed drush, then cd to my site root directory and i used drush dl seo_checklist which worked fine.

when I run drush en seo_checklist I get the following output:

Command pm-enable needs a higher bootstrap level to run - you will need to invoke drush from a more functional Drupal environment to run this command. [error]  

The drush command 'en seo_checklist' 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.  

Drush was attempting to connect to:  
 Drupal version         :  7.34  
 Site URI               :  http://default  
 PHP executable         :  /usr/bin/php  
 PHP configuration      :  /etc/php.ini  
 PHP OS                 :  Linux  
 Drush version          :  7.0-dev  
 Drush temp directory   :  /tmp  
 Drush configuration    :  
 Drush alias files      :  
 Drupal root            :  /var/www/html/mytestsite  
 Site path              :  sites/default  

i did modify my settings file to include:

'host' => php_sapi_name() == 'cli' ? '' : 'localhost'  


drush st returns the following:

 PHP executable         :  /usr/bin/php  
 PHP configuration      :  /etc/php.ini  
 PHP OS                 :  Linux  
 Drush version          :  7.0-dev  
 Drush temp directory   :  /tmp  
 Drush configuration    :  
 Drush alias files      :  

everything inside the root folder has 755 permissions and belongs to apache:apache

I am running the drush command as root. i have no idea what could be causing the problem.

  • If the inline if, try adding parenthesis in this line 'host' => (php_sapi_name() == 'cli') ? '' : 'localhost'. I believe inline if's need () to eval true or false – Rick Feb 6 '15 at 16:19
  • thanks for the input, i tried but it did not make a difference... i also tried to set it only to or only to localhost neither helped... – J.H. Feb 6 '15 at 16:47
  • So you're able to do a drush st (for status) and get output without error? What happens when you run without root? How do you have your folders permissions? Answer these in a question edit. – Rick Feb 6 '15 at 17:24

Is your settings.php file in sites/all/default? If not, you'll need to add the --uri option. If your settings.php file is in sites/all/foo.com, then add --uri=foo.com.

drush --uri=foo.com en seo_checklist

Or, change your working directory to the same folder that contains settings.php.

Or, define a site alias @foo that defines 'root' and 'uri', and then use:

drush @foo en seo_checklist

  • the settings file is in sites/default/ – J.H. Feb 6 '15 at 20:52

To actually find out why this is happening so you get a better idea of how to fix it, run a drush command with the --debug option. eg: drush pm-list --debug. Then look through the output to see anything that might be causing the problem.


In my case it turned out that I needed to install mysql-client:

apt-get install mysql-client

I had the following situation: drush 4, 5 and 6 worked fine for me. drush 7, 8 don't work (different errors, including that ones you're describing). And my MySQL database was located on a separate server.

HTH, Alexander


I had the same problem and had to add something to $PATH by editing my .bash_profile

# Add PHP to drush path export DRUSH_PHP='/Applications/MAMP/bin/php/php[your-php-version]/bin/php'

see Drush does not work on my Mac

  • i saw this comment but it seemed to apply to windows and mac, i couldn't find anything similar regarding linux – J.H. Feb 6 '15 at 20:57
  • also drush seems to find the php directory (check the edit to the question for drush st) – J.H. Feb 6 '15 at 21:07

Seems like you are runing drush from outside a drupal webroot folder. Ensure you are running drush from inside the folder where drupal is, anywhere within that folder drush should not give you this error


Update PHP, I had the same issue with CentOS6, replaced PHP 5.3.3 with 5.5.22 from webtactic and drush ran no problem.

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