8 – How does Acquia Dev Desktop create the connection to the database?

Thank you all for your help and point me to the right direction !

I will give a detailed explanation because i believe this will benefit plenty of people with common error as mine !

Acquia Dev desktop 2, while creating/importing you website, will create a hidden file (loc_your_site_dd.inc) within its folders where the database connection code is located and then it will refer to that file by adding at the bottom of your setting.php file, few lines of codes similar to:


// 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') . '/loc_sitename_dd.inc')) {
require $_SERVER('DEVDESKTOP_DRUPAL_SETTINGS_DIR') . '/loc_sitename_dd.inc'; 


Actually this is not a problem and this is how Acquia Dev desktop handle the database connection and other configuration codes.

However, if you are using Drush with your Drupal 8 website but you are using it from a Git Bash instead of using the built-in cmd inside Acquia Dev Desktop, you will be facing a problem similar to this one:

The drush command 'XXX' could not be executed. 
(error) Drush was not able to start (bootstrap) the Drupal database. 

The problem here is that Drush won’t be able to find the which it was added to your sites settings.php file and so it will not be able to find a connection to the database and in result will display the above error.


The best solution here is to find the hidden file created by Acquia Dev Desktop which is usually in Windows is located at (*C:Usersusername.acquiaDevDesktopDrupalSettings*) and copy and pasted all of its contents to your settings.php file and then from inside the settings.php file, delete the code codes added by Acquia Dev desktop.

Doing so, now Drush will be able to find a connection to the database and all will be working as expected.