Main content

Managing settings.php

Main Drupal configuration file. Contains database credentials and other important settings.

See the latest defaults: /core/assets/scaffold/files/default.settings.php.

This file in the core assets directory is copied into /sites/default when drupal is installed with composer

It's a good idea to read through this every once in a while to learn about available options.

Remove comments

You can remove all comments from your settings.php file, which makes it easier to scan everything in there.

settings.local.php

At the bottom of the default settings.php, uncomment the lines for including settings.local.php.

It's a good idea to keep your project in a git repo. But you don't want to store sensitive information like database credentials, api keys, and hash values.

Move those settings into settings.local.php and ensure the file is ignored by .gitignore. This way you safely check settings.php into the repo and use settings.local.php files on the server and local environments to use different db settings.

Copy /sites/example.settings.local.php to sites/SITES/setting.local.php to enable development settings.