Drupal 8+ example settings.local.php file

<?php

$databases['default']['default'] = [
  'database' => '',
  'username' => '',
  'password' => '',
  'host' => 'localhost',
  'port' => '',
  'driver' => 'mysql',
  'prefix' => '',
  'collation' => 'utf8mb4_general_ci',
  'init_commands' => [
    'isolation_level' => 'SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED',
  ],
];

$settings['file_private_path'] = '../../private_files';

$settings['trusted_host_patterns'] = [
  '^(.*\.)?example\.coop$',
];

$settings['reverse_proxy'] = TRUE;
$settings['reverse_proxy_addresses'] = array('127.0.0.1');

if (getenv('HTTPS') !== 'on' && getenv('HTTP_X_FORWARDED_PROTO') === 'https') {
  $_SERVER['HTTPS'] = 'on';
  $_SERVER['SERVER_PORT'] = 443;
}

$settings['state_cache'] = TRUE;

$config['config_split.config_split.production']['status'] = TRUE;

/**
 * Dev site settings.
 */

/**
 * Stage file proxy settins.
 */
$config['stage_file_proxy.settings']['origin'] = 'https://example.coop';

/**
 * Show all error messages, with backtrace information.
 *
 * In case the error level could not be fetched from the database, as for
 * example the database connection failed, we rely only on this value.
 */
$config['system.logging']['error_level'] = 'verbose';

/**
 * Disable CSS and JS aggregation.
 */
$config['system.performance']['css']['preprocess'] = FALSE;
$config['system.performance']['js']['preprocess'] = FALSE;

/**
 * Error reporting.
 *
 * As a developer it is useful to see all errors. If the site you are working
 * on has a lot of notice errors and you aren't able to fix them you can
 * suppress them by modifying E_ALL in error_reporting to:
 * E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED
 */
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);

/**
 * Limit Watchdog entries.
 */
$config['dblog.settings']['row_limit'] = 1000;


Links

  • [[2025-W21]]