Chris J. Lee

Dallas Drupal Developer

You are here

local dev stage prod settings.php file management

Quickly add a local settings file to your settings.php. Having a set of cascading settings files is way easier than the built in folder method that drupal uses. It's a bit of too much overhead.

I much prefer the following method instead of creating a seperate folder for your settings file


#!/bin/bash
// Backup existing local.settings file
cp sites/default/settings.php sites/default/local.settings.php
# append local settings file to the end of the file
curl -o- https://raw.github.com/gist/1235389/9063dd55898adbd99ad3211dd0e0b397108b161d/settings-router.php >> sites/default/settings.php
// now modify the local.settings file with the correct $database array
// echo "vim sites/default/settings.php"

Hopefully in Drupal 8 this issue will be a lot easier with CMI.

© 2017 Chris J. Lee