This project is not covered by Drupal’s security advisory policy.

Drush extension to generate settings.php files.

When deploying a site to a new environment, it is a common need to create a new settings.php file. This Drush extension provides a command that helps generating it.

At present it only generates settings.php files for Drupal 7 sites. Drupal 8 support is on the way.

This project is also the room for skel-files-create command. This command creates a skel of folders to store files (public, private, translations, ...) out of the document root.

Usage examples

Command: settingsphp-generate

drush settingsphp-generate --db-url=mysql://root:root@localhost/drupal

Run from a Drupal codebase. It creates settings.php under sites/default/, or the site directory from which the command is performed.

drush @site settingsphp-generate

Creates settings.php for the site defined by @site. Database settings are picked from the alias. You can use either db-url or databases key in the alias declaration. If databases is used, all databases will be added.

drush @site settingsphp-generate --db-url=mysql://root:root@localhost/drupal

Will create settings.php for the site defined by @site. It uses database settings passed in --db-url, and ignores any database settings declared in the alias.

Command: skel-files-create

drush @site skel-files-create --owner=vagrant --ancestors=1 

Creates shared/{public,private,translations} directories in the parent folder of the site document root. Directories are owned by vagrant user and group.


Creates also a relative symlink from sites/default/files (or the site directory of @site) to ../../../shared/public.

drush @site skel-files-create --owner=root --group=www-data --ancestors=2 --all

Creates the skel of directories in the grandparent of the drupal root, owned by root:www-data for all sites found in a multisite Drupal.

Tweak settings

You can add more settings (for example $cookie_domain) by implementing hook_settingsphp_generate_alter().

This hook must be declared in your own drush commandfile to alter settings before generating settings.php. See settingsphp.api.php for details.

Support and customizations

The module author provides paid development and consulting services. Contact Jonathan Araña Cruz.

You can also support this module by giving cash gifts via Gratipay.

Supporting organizations: 
sponsored the initial development and further functionalities

Project information

Releases