11

I just setup a new Drupal environment with Mamp. I can access my website just fine, but whenever I want to run drush cr I get the following error :

exception 'RuntimeException' with message 'Missing $settings['hash_salt'] in settings.php.' in /Applications/MAMP/htdocs/soa-drupal/core/lib/Drupal/Core/Site/Settings.php:130                     [error]
Stack trace:
#0 /Applications/MAMP/htdocs/soa-drupal/core/lib/Drupal/Core/PhpStorage/PhpStorageFactory.php(47): Drupal\Core\Site\Settings::getHashSalt()
#1 /Applications/MAMP/htdocs/soa-drupal/core/includes/utility.inc(53): Drupal\Core\PhpStorage\PhpStorageFactory::get('service_contain...')
#2 /usr/local/Cellar/drush/HEAD/libexec/commands/core/cache.drush.inc(278): drupal_rebuild(Object(Composer\Autoload\ClassLoader), Object(Symfony\Component\HttpFoundation\Request))
#3 [internal function]: drush_cache_rebuild()
#4 /usr/local/Cellar/drush/HEAD/libexec/includes/command.inc(359): call_user_func_array('drush_cache_reb...', Array)
#5 /usr/local/Cellar/drush/HEAD/libexec/includes/command.inc(210): _drush_invoke_hooks(Array, Array)
#6 [internal function]: drush_command()
#7 /usr/local/Cellar/drush/HEAD/libexec/includes/command.inc(178): call_user_func_array('drush_command', Array)
#8 /usr/local/Cellar/drush/HEAD/libexec/lib/Drush/Boot/DrupalBoot.php(46): drush_dispatch(Array)
#9 /usr/local/Cellar/drush/HEAD/libexec/drush.php(76): Drush\Boot\DrupalBoot->bootstrap_and_dispatch()
#10 /usr/local/Cellar/drush/HEAD/libexec/drush.php(16): drush_main()
#11 {main}

I'm using PHP 5.5.18, Drupal 8, and drush 7.0-dev.

This is my drush status

 Drupal version         :  8.0.0-dev                                                                                                     
 Site URI               :  http://default                                                                                                
 Database driver        :  mysql                                                                                                         
 Database hostname      :  127.0.0.1                                                                                                     
 Database port          :  3306                                                                                                          
 Database username      :  root                                                                                                          
 Database name          :  soa-drupal                                                                                                    
 PHP executable         :  /Applications/MAMP/bin/php/php5.5.18/bin/php                                                                  
 PHP configuration      :  /Applications/MAMP/bin/php/php5.5.18/conf/php.ini                                                             
 PHP OS                 :  Darwin                                                                                                        
 Drush version          :  7.0-dev                                                                                                       
 Drush temp directory   :  /tmp                                                                                                          
 Drush configuration    :                                                                                                                
 Drush alias files      :                                                                                                                
 Drupal root            :  /Applications/MAMP/htdocs/soa-drupal                                                                          
 Site path              :  sites/default                                                                                                 
 Active config path     :  sites/default/files/config_84eNw07-YSmRQWPQMlntbzkr8XYtLAeb-NhiTEwq_mqFMWpmB2I6oLcHwhzMgJ-NDa2EkJXhug/active  
 Staging config path    :  sites/default/files/config_84eNw07-YSmRQWPQMlntbzkr8XYtLAeb-NhiTEwq_mqFMWpmB2I6oLcHwhzMgJ-NDa2EkJXhug/staging 

My settings.php file does have this hash_salt line.

$settings['hash_salt'] = 'bUmc1PV9VzwAXban_VVRtSKKwOBp7QNugOCWzsUrRgyy7Zl7D2dJm-J8Wb5FWOUrDKH7zepC2A';

I have tried changing localhost to 127.0.0.1, updating drush, adding pretty much everything to the $PATH.. No luck so far, and I've visited every single website mentioning this error.

7
  • According to this discussion it seems to be fixed with drupal8.0.0-beta4 : github.com/drush-ops/drush/issues/1050 Commented Dec 22, 2014 at 23:49
  • 2
    This should not have been closed. This may help someone "Can you look at your settings.php file and see if you have $settings['hash_salt'] set to anything? Thats required in D8." => github.com/drush-ops/drush/issues/1050#issuecomment-67723261 Commented Apr 20, 2016 at 2:04
  • 1
    @ElijahLynn: "My settings.php file does have this hash_salt line." The OP already said the settings.php file has that variable set.
    – avpaderno
    Commented May 15, 2016 at 11:32
  • What if the there is a settings.local.php file resetting the hash salt line?
    – Jigarius
    Commented Jan 26, 2017 at 20:44
  • If your settings.local.php needs adding just use this and it will work for you after a cache reload $settings['hash_salt'] = 'CHANGE_THIS';
    – BigEd
    Commented Jun 27, 2018 at 14:05

0

Browse other questions tagged or ask your own question.