2

I installed Acquia Dev Desktop. Most things work but drush does not. I get an error: Drush was not able to start (bootstrap) the Drupal database.

Because I had previously installed php and mysql on my local, I removed those old versions and adjusted my ~/.bash_profile to ensure I was loading the Acquia Dev Desktop version of php, mysql, and drush. To test, I run "which php", "which mysql", and "which drush" all of which returned the Acquia Dev Desktop version.

To test mysql, from my drupal site directory I entered the mysql cli with "mysql". I ran "show databases" and confirmed the Acquia Dev Desktop Database is in this Mysql server.

To test the php, from my drupal site directory I ran "php -r 'phpinfo();'". I confirmed the PHP version/config loaded is the Acquia Dev Desktop version.

I see in drush looks for aliases in ~/.acquia/DevDesktop/Drush/Aliases/aliases.drushrc.php I inspected that file and see the alias configured as loc.mysite.dev. I tried my drush commands using that alias. "drush @loc.mysite.dev status". This made no difference.

My drupal install is setup like a multisite. Maybe that is an issue though I always use multisite and have no issue with this same site and drush in a vagrant box (not using Acquia Dev Desktop). I am running my drush commands from my site directory (sites/mysite.org) which is where my settings file is (sites/mysite.org/settings.php).

Here are some drush debug outputs This is the issue after installing Acquia Dev Desktop https://gist.github.com/maestrojed/78ff27cfae1f65821ce8 This is the issue after installing Acquia Dev Desktop AND my attempts to get drush to use the correct Acquia Dev Desktop versions of Drush and PHP. https://gist.github.com/maestrojed/45c1635f5d1d88d4bd9e

I have to use Acquia Dev Desktop and I don't think I can live without drush. I am happy to provide any other info to help debug. Any tips are greatly appreciated! Thanks. - See more at: https://forums.acquia.com/acquia-products-and-services/dev-desktop/cant-get-drush-work#sthash.bZJBgcc0.dpuf

4 Answers 4

2

Use the console coming with ADD - launch the console from the ADD client. Using that console everything is correct setup. You might of course get everything to work inside your "Bash" (which it think you are using since you talk about the "which" command), but it kind of removes the whole point of using ADD - that everything is working out the box.

PS! I use Git Bash for my Git work and the ADD (cmd) console for Drush work. Then I don't have to think ;-)

2
  • "Use the console coming with ADD - launch the console from the ADD client. Using that console everything is correct setup" That was not my experience. I installed ADD, I launched Terminal from the little icon in ADD. Drush did not work. My first debug link shows the output after a fresh ADD install and launching console from ADD.
    – maestrojed
    Commented Feb 26, 2016 at 23:08
  • Hm, for some reason I missed your reply/comment. I know it's an old question now, but I though I should explain why it didn't work for you: You weren't using the Drush coming with ADD. Probably you had Drush installed before and it was earlier in the path than the Drush coming with ADD. I can says this because your debug output says "Drush version : 6.5.0". Already in 2014 ADD switched to Drush 7 ...
    – hansfn
    Commented Nov 4, 2016 at 10:05
2

When using Acquia and Acquia Dev Desktop the settings.php is autogenerated by Acquia. If you review that settings.php file you will noticed there are no databases credentials but instead an Acquia config file is included within a conidtional. That conditional and file are:

// <DDSETTINGS>
// Please don't edit anything between <DDSETTINGS> tags.
// This section is autogenerated by Acquia Dev Desktop.
if (isset($_SERVER['DEVDESKTOP_DRUPAL_SETTINGS_DIR']) && file_exists($_SERVER['DEVDESKTOP_DRUPAL_SETTINGS_DIR'] . '/cld_devcloud_mysite_dev_mysite_org.inc')) {
  require $_SERVER['DEVDESKTOP_DRUPAL_SETTINGS_DIR'] . '/cld_devcloud_mysite_dev_mysite_org.inc';
}
// </DDSETTINGS>

This included file contains the database connection info. It seems that Drush doesn't include this file. I assume because when run by drush the conditional is not satisfied.

I added my own additional include to the bottom of settings.php to include a local file if it exists.

/**
 * Include a local settings file if it exists.
 */
$local_settings = dirname(__FILE__) . '/local.settings.php';
if (file_exists($local_settings)) {
  include $local_settings;
}

I added the exact same content from the cld_devcloud_mysite_dev_mysite_org.inc file into this local.settings.php file.

Now drush works. My conditional is satisfied. Site continues to run fine locally in Acquia Dev Desktop.

Seems drush should load those Acquia includes and it must for most people as I didn't find many others with this issue. Not sure why my setup acted differently.

maestrojed

1

Maestrojed's own answer identifies the settings file, and hansfn has already pointed out you may need to launch the terminal session via DevDesktop itself.

Other things you can do:

  • First, check drush status (which'll show if it has the correct db name)
  • Run drush commands with the --verbose switch, which'll show bootstrap status (but beware the bootstrap debug messages can be misleading)
  • Try using Drush to launch a MySQL console – drush sqlc
  • if you're using a Drupal 8 composer setup (recommended), install the latest version of Drush with composer, rather than relying on the version that comes with DevDesktop (run composer require drush/drush). One odd situation I had was the drush updb command connecting to a different database to everything else (I found this out by adding the --verbose option), and upgrading fixed that.
  • beware of a ~/.my.cnf file forcing the wrong username
0

Drush is not picking up the acquia site settings.
Add the acquia settings to your .bash_profile or path so drush can access them.

export DEVDESKTOP_DRUPAL_SETTINGS_DIR="$HOME/.acquia/DevDesktop/DrupalSettings"

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.