Community Documentation

Defining variables in a site's settings.php $conf array

Last updated November 19, 2012. Created by nevos on April 10, 2012.
Edited by chrisjlee, matkeane, Drave Robber. Log in to edit this page.

General

The Drupal installation process and Drupal Modules use the variables table to store different types of information that will be used on runtime. The values of these variables can be overridden in the settings.php file. (see usage section below)

Following is the list of default variables available on a fresh install (It’s important to note that every module core or contributed, when enabled, may add other variables that can be altered in the configuration setting).

Default settings.php variables on a fresh install

Drupal 6

Variable
Name
Explanation Default value (when applicable)
theme_default Sets the default theme. "garland"
filter_html_1   1
node_options_forum Forum topics are published by
default, but do not have any other default options set (for example, they are
not promoted to the front page).
Array
drupal_private_key A random MD5 encoded hash used to
generate tokens.
Array
menu_masks    
install_task Marks the installation as 'done'
when out of tasks.
"done"
menu_expanded a list of menus with expanded items. documentation Array
site_name Site name. Installation dependant
site_mail Site e-mail address. Automated
e-mails, such as registration information, will be sent from this address.
Installation dependant
date_default_timezone Default timezone for the site Installation dependant
user_email_verification Require e-mail verification when a
visitor creates an account. If TRUE, new users will be required to validate
their e-mail address prior to logging into the site, and will be assigned a
system-generated password. With it unchecked, users will be logged in
immediately upon registering, and may select their own passwords during
registration.
TRUE/FALSE
clean_url Disable/Enable Clean URLs "1"
install_time Record of when the install ran. timestamp
node_options_page Default "Basic page" not
promoted.
Array
comment_page Disable/Enable Default "Basic
page" comments.
0
theme_settings An array with theme settings. documentation Array
css_js_query_string Dummy query string added to all
CSS and JavaScript files.
"X0000000000000000000"
install_profile documentation "default"
dev_query Disable/Enable devel query
logging.
"FALSE"
cron_safe_threshold Default interval for automatic
cron executions in seconds.
0

Drupal 7

Variable
Name
Explanation Default value (when applicable)
admin_theme Sets the default administration theme. "seven"
clean_url Disable/Enable Clean URLs "1"
comment_page Disable/Enable Default "Basic page" comments 0
cron_key: Used to access the cron page. The URL of the cron.php page requires a
"cron key" to protect against unauthorized access. The full URL of the page,
with the cron key, is available in the "Cron maintenance tasks" section
of the Status report page at Administration/Reports/Status report.
Site specific
cron_last Record last cron time. timestamp
css_js_query_string Dummy query string added to all CSS and JavaScript files. timestamp converted to base 36
date_default_timezone Default timezone for the site. Installation dependant
drupal_private_key A random base-64 encoded hash used to generate tokens. Installation dependant
file_temporary_path The path of system-appropriate temporary directory. Can be changed at:
Administer/Site configuration/File system
OS dependant
filter_fallback_format All sites require at least one text format (the fallback format) that
all users have access to. Initialized as a simple, safe plain text format.
"plain_text"
install_profile documentation "standard"
install_task marks the installation as 'done' when out of tasks. "done"
install_time Record of when the install ran. timestamp
menu_expanded a list of menus with expanded items. documentation Array
menu_masks   Array
node_admin_theme For using the administration theme when editing or creating content. "1"
node_options_page Default "Basic page" not promoted. Array
node_submitted_page Display/Don't display date and author information for "Basic page" nodes. "FALSE"
path_alias_whitelist An array containing a white list of path aliases. Array
preprocess_css Aggregate and compress CSS files. "1"
preprocess_js Aggregate and compress Javascript files. "1"
site_default_country Sets the Default country of the website. Installation dependant
site_mail Site e-mail address. Automated e-mails, such as registration information,
will be sent from this address.
Installation dependant
site_name Site name. Installation dependant
theme_default Sets the default theme. "bartik"
update_last_check Last check for updates. timestamp
update_notify_emails The site maintenance account's email addresses to be notified when updates
are available.
Array
user_admin_role Set the administrator role id. "3"
user_pictures Enable/Disable user pictures. "1"
user_picture_dimensions Pictures larger than this will be scaled down to this size. "1024x1024"
user_picture_file_size Maximum allowed file size for uploaded user pictures. "800"
user_picture_style The style selected will be used on display. "thumbnail"
user_register Allows visitor account creation with administrative approval by default. 2
404_fast_paths_exclude Paths to return a simple, fast 404 page for URLs matching a specific pattern.
A regular expression to match paths to exclude, such as images generated
by image styles, or dynamically-resized images. If you need to add more
paths, you can add '|path' to the expression.
"/\/(?:styles)\//"
404_fast_paths A regular expression to match paths that should return a simple 404 page,
rather than the fully themed 404 page. If you don't have any aliases ending
in htm or html you can add '|s?html?' to the expression.
"/\.(?:txt|png|gif|jpe?g|css|js|ico|swf|flv|cgi|bat|pl|dll|exe|asp)$/i"
404_fast_html The html to return for simple 404 pages. HTML Code provided by default.

Usage

Entries in the settings.php $conf will override whatever's in the variables
table of your database. This is really useful when you need different configs
for your different LOCALHOST|DEV|TST|PRD environment.
On top of overriding the default values from the variables table, you can add your own set of variable to use on runtime.

Example for Drupal 6

$conf = array(
'site_offline' => FALSE, //Take the site online or offline. (Also known as Maintenance Mode.)
'maintenance_theme' => 'minnelli', //When in maintenance mode, what theme do you want?
'site_name' => 'Example.com DEV', //Define the name of the site on the dev server.
'theme_default' => 'Bartik', //Set the theme which will be used on this site; Zen, Bartik, Garland, whatever.
'admin_theme' => 'Rubik'; //Set the administrative theme on your own machine, regardless of what the rest of the team uses. :)
'anonymous' => 'Visitor', //What should anonymous users be labeled?
'securepages_enable' => FALSE, //Turn off Secure Pages for your dev or local server.
'securesite_enabled' => '0', //Disable the SecureSite module.
'rules_debug' => '1', //Enable the debugging output of the Rules module on your localhost box.
'preprocess_css' => FALSE, //Disable CSS compression.
'preprocess_js' => FALSE, //Disable JS compression.
)

Example for Drupal 7

$conf['site_name'] = 'My Drupal Dev site';
$conf['theme_default'] = 'garland';
$conf['anonymous'] = 'Dev Visitor';
$conf['maintenance_theme'] = 'bartik';
$conf['cache_backends'][] = 'includes/cache-install.inc';
$conf['cache_default_class'] = 'DrupalFakeCache';
$conf['cache_class_cache_page'] = 'DrupalDatabaseCache';

Other useful Variables

Comments

Overriding Array Variables

If you need to override a variable that is set as an array in the database, this is the method I found that worked for me.

$conf['imce_custom_process'] = unserialize('a:1:{s:26:"imce_mkdir_process_profile";i:1;}');

I'm sure there is a more efficient way to do this since I'm unserializing data only to have it serialized again but this was the only way I could get this type of variable to work.

Page status

Needs copy/style review

Log in to edit this page

About this page

Drupal version
Drupal 6.x, Drupal 7.x
Audience
Contributors, Programmers, Site administrators
Level
Intermediate, Advanced
Keywords
module settings, settings configuration, settings.php, variables
Drupal’s online documentation is © 2000-2013 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License. Comments on documentation pages are used to improve content and then deleted.