Skip to content

Instantly share code, notes, and snippets.

@benclark
Forked from brockboland/local.settings.php
Last active September 29, 2015 20:48
Show Gist options
  • Save benclark/1665472 to your computer and use it in GitHub Desktop.
Save benclark/1665472 to your computer and use it in GitHub Desktop.
My local settings for Drupal sites
<?php
/**
* @file
* local.settings.php (Drupal 6.x)
*
* This settings file is intended to contain settings specific to a local
* development environment, by overriding options set in settings.php.
*
* Include this file from your regular settings.php by including this at the
* bottom:
*
* @include('local.settings.php');
*
* Placing this at the very end of settings.php will allow you override all
* options that are set there. Prefixing it with the @ suppresses warnings if
* the local.settings.php file is missing, so you can commit this to your repo.
*/
// Toggle the use of memcache.
$_use_memcache = FALSE;
// Toggle the output of devel debugging/logging.
$_use_devel = FALSE;
// Path where all contrib modules can be found.
$_contrib_path = 'sites/all/modules/contrib';
// The name of the database. This will also be used as the memcache prefix.
$_db_name = 'dbname';
// Database configuration.
if (is_array($db_url)) {
$db_url['default'] = 'mysqli://root:root@debianvm/' . $_db_name;
}
else {
$db_url = 'mysqli://root:root@debianvm/' . $_db_name;
}
// Allow anyone to run update.php.
$update_free_access = FALSE;
// Set error reporting level to ignore notices and deprecated warnings. These
// should be turned back on during development to clean up any code that
// generates them.
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);
// Note that these options can also be moved into index.php, so that errors
// that occur before settings.php will also be reported.
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
// Fix for fast_404 module under lighttpd.
$_SERVER['QUERY_STRING'] = preg_replace('/&$/i', '', $_SERVER['QUERY_STRING']);
// Prep the $conf array.
if (!is_array($conf)) {
$conf = array();
}
// Save email messages to the log instead of sending them out. This is to
// prevent accidental email sends from a development site.
// Make sure you adjust this value if the Devel module is located elsewhere
$_smtp_library = $_contrib_path . '/devel/devel.module';
if (is_file($_smtp_library)) {
$conf['smtp_library'] = $_smtp_library;
}
// Disable Secure Pages and Secure Site module functionality
$conf['securepages_enable'] = 0;
$conf['securesite_enabled'] = 0;
// Use a test payment gateway to prevent real transactions
$conf['uc_payment_credit_gateway'] = 'test_gateway';
// Lower the search indexing per cron run to prevent long cron runs
$conf['search_cron_limit'] = 5;
// Reverse proxy
$conf['reverse_proxy'] = TRUE;
$conf['reverse_proxy_addresses'] = array('127.0.0.1');
// Disable preprocessing of CSS and JS.
$conf['preprocess_css'] = 0;
$conf['preprocess_js'] = 0;
// Use environment indicator, if available.
$conf['environment_indicator_enabled'] = TRUE;
$conf['environment_indicator_text'] = 'LOCAL DEVELOPMENT';
$conf['environment_indicator_color'] = 'dark-red';
// Use memcache if available & enabled.
$_memcache_inc = $_contrib_path . '/memcache/memcache.inc';
if ($_use_memcache && is_file($_memcache_inc)) {
// Configure memcache locally
$conf['memcache_servers'] = array(
'debianvm:11211' => 'default',
);
$conf['memcache_bins'] = array(
'cache' => 'default',
);
$conf['memcache_key_prefix'] = $_db_name;
$conf['cache_inc'] = $_memcache_inc;
}
else {
// Revert to Drupal core caching in case settings.php
// is configured to use Memcache.
$conf['cache_inc'] = 'includes/cache.inc';
}
// Devel settings
if ($_use_devel) {
$conf['dev_query'] = 1;
$conf['devel_query_display'] = 1;
$conf['devel_query_sort'] = 0;
$conf['devel_execution'] = 5;
$conf['devel_store_queries'] = 0;
$conf['devel_store_random'] = 1;
$conf['devel_redirect_page'] = 0;
// Enable xhprof profiling of each page request.
$conf['devel_xhprof_enabled'] = 0;
$conf['devel_xhprof_directory'] = "/var/www/xhprof";
$conf['devel_xhprof_url'] = "http://debianvm/xhprof/xhprof_html";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment