Skip to main content

The Cheeky Monkey Media Blog

A few words from the apes, monkeys, and various primates that make up the Cheeky Monkey Super Squad.


Defining variables in settings.php

If you’ve ever setup a drupal installation before, then you’re familiar with the settings.php file. This little file resides in the default folder on a typical drupal install. Normally, its only used to simply tell drupal about our database name and password. However, there are some other cool things you can do with it.

CSS/JS Aggregation

Often, we’ll work on sites locally then push it up to staging or production for the client or the world to see. If you’re a good little web developer, you will want to minify and aggregate your assets, but having to disable css and javascript aggregation every time to pull the latest master database, can often leave one puzzled.

Because settings.php is not part of our repo, you can easily make edits on your local settings.php with the following variables overrides in it:

  1. // Aggregate and compress CSS files in Drupal - off.
  3. $conf['preprocess_css'] = 0;
  5. // Aggregate JavaScript files in Drupal - off.
  7. $conf['preprocess_js'] = 0;

Site Mail

If you’re looking to test email notifications on your local development machine and don’t want to send notification to the person that receives e-mails on the production site, you could set the sites admin e-mail in settings.php as well.

  1. $conf[‘site_mail’] = ‘’;

Custom Settings

You can also set custom settings that you can use in your php code, for example, a web key. You will set this variable the same way you overwrite existing ones.

  1. $conf[‘my_custom_settings’] = ‘This is my custom string’

To get the variable in code use the handy variable_get() function

  1. echo variable_get(‘my_custom_settings);


A full list of the default variables that you can overwrite can be found in the drupal documentation and adding contrib modules can add extra variables that you might want to overwrite on your next project.

Web Development

Would you like to know more about what we do?

View Our Services

Graphic Design Cheeky Monkey

Have a look at some our client work

View Our Work

Cheeky Monkey Discovery

Learn more about Cheeky Monkey Media

About Us