I know there is a environment_indicator module that displays a bar on the bottom of the website showing if your on staging or dev. http://drupal.org/project/environment_indicator

I want to know if there is a way to do this without having to install a module, by doing it via the settings.php file where I can make it output some html to indicate im on staging or dev.

1 Answer 1


You can't output HTML (or text) directly from settings.php without throwing an error, since settings.php is interpreted during bootstrap.

Provided you have a clean install, on your staging site, have the following line in settings.php:

$conf['site_name'] = 'This is a staging site';

All assignments to the $conf array you do in settings.php will override whatever value you set the in the administrative GUI for the site.

An alternative solution, if you don't have a clean install and the site's name is no longer displayed by default, is to add your own conf variable to settings.php:

$conf['is_staging_p'] = TRUE;

and modify your theme to output some indicator if this predicate is TRUE;

  • yes that works, but i still have to configure either the blocks or edit the theme to print out the site_name variable. I was wondering if there was a way to just do it via the settings.php file and not have to touch anything else on the site. May 24, 2013 at 23:49
  • I need to do this for a live site im cloning into staging servers. May 25, 2013 at 0:10
  • i know im being a bit strict and limited what not the change. i dont even know if its possible. im just limiting it to just being able to edit the settings.php file and nothing else. I mean i can do a print_r on that page, but that throws an error since it will output before the headers... i wonder if its possible inject something after the headers, but it has to reside in settings.php May 25, 2013 at 0:22
  • @duckx no, you can't do that without writing code further up the chain (ie in a module or theme). settings.php isn't the right place for display logic anyway...it's for settings :)
    – Clive
    May 25, 2013 at 11:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.