(03-14-2016, 07:21 AM)kilishan Wrote: One way that I've handled this in other situations where CI_ENV wasn't available, or the client wasn't tech-savvy enough to set it keep it set was something like this in CI's index.php file:
Code:
$domain = ! empty($_SERVER['HTTP_HOST']) ? strtolower($_SERVER['HTTP_HOST']) : 'cli';
if (strpos($domain, '.dev') !== false || $domain == 'cli')
{
define('ENVIRONMENT', 'development');
}
else {
define('ENVIRONMENT', 'production');
}
Don't do this. It allows any user to force 'development' as the ENVIRONMENT value.