Dev site settings.php tweaks (Drupal 7)

Public

Some standard configuration ($conf) variables I add to most dev sites.

Get raw version
php
  1. $conf['file_public_path'] = 'relative/path/to/public/files/directory'; // usually sites/default/files
  2. $conf['file_private_path'] = '/absolute/path/to/private/files/directory';
  3. $conf['file_temporary_path'] = '/absolute/path/to/tmp/directory'; // usually /tmp
  4. $conf['securepages_enable'] = FALSE;
  5. $conf['reroute_email_enable'] = TRUE;
  6. $conf['cache'] = FALSE; //page cache
  7. $conf['block_cache'] = FALSE; //block cache
  8. $conf['preprocess_css'] = FALSE; //optimize css
  9. $conf['preprocess_js'] = FALSE; //optimize javascript
  10. error_reporting(-1);
  11. $conf['error_level'] = 2;
  12. ini_set('display_errors', TRUE);
  13. ini_set('display_startup_errors', TRUE);

Comments

timonweb's picture

Cool, but there's a typo on line 6, should be: $conf['reroute_email_enable'] = TRUE;

ultimike's picture

@timonweb - thanks! Typo fixed.

-mike

esbite's picture

Thank you! Good stuff. Though I can't get any sort of $conf['module_enable'] to work, for example it never enables devel even though it should.

Do I need another module or something for it to work?

ultimike's picture

@esbite - your comment made me wonder about "devel_enable" as well. Turns out it was a figment of my imagination and doesn't actually do anything, so I removed it from the code snippet above.

Thanks,
-mike

pari's picture

It's also possible to set condition to automatically select DEV or PRODUCTION (condition vary by your environment), I am using this rule:

  1. function getServerAddress() {
  2. if(array_key_exists('SERVER_ADDR', $_SERVER))
  3. return $_SERVER['SERVER_ADDR'];
  4. elseif(array_key_exists('LOCAL_ADDR', $_SERVER))
  5. return $_SERVER['LOCAL_ADDR'];
  6. else {
  7. return false;
  8. }
  9. }
  10.  
  11. if(getServerAddress() == '127.0.0.1' || $_SERVER['HTTP_HOST'] == 'localhost' || (drupal_is_cli() && function_exists('drush_main'))) {
  12. //DEVELOPMENT
  13. }else{
  14. //PRODUCTION
  15. }
deborahphilip007's picture

I really enjoy simply reading all of your weblogs. Simply wanted to inform you that you have people like me who appreciate your work. Definitely a great post. Hats off to you! VPN for China