[eluser]BrianDHall[/eluser]
For pure, pure performance, and with the likelyhood that you need the config variables available in most page accesses to your site, open up config.php and define constants. Constants can't change in value, so PHP can handle them differently than regular variables.
Phil Sturgeon gave me this particular usage, and it is what I now have on all my sites in config.php:
Code:
if(strpos($_SERVER['SERVER_NAME'], 'local') !== FALSE)
{
define('ENV', 'local');
}
elseif(strpos($_SERVER['SERVER_NAME'], 'dev.') === 0)
{
define('ENV', 'dev');
}
elseif(strpos($_SERVER['SERVER_NAME'], 'qa.') === 0) {
define('ENV', 'qa');
}
else
{
define('ENV', 'live');
}
Now I use ENV constant to determine if SSL is enabled (SSL doesn't work on my localhost, for instance), if calls to CURL are made or short-circuited for testing purposes (again my localhost isn't setup for curl and I don't wanna bother), what database settings are used, etc etc.