Welcome Guest, Not a member yet? Register   Sign In
$_SERVER['CI_ENV'] -- where is and ENVIRONMENT this set?
#11

(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 Smile 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.
Reply
#12

(03-14-2016, 07:36 AM)Narf Wrote: Don't do this. It allows any user to force 'development' as the ENVIRONMENT value.

Damn, good point. Bad developer, no cookie.

And thanks for pointing that out.
Reply
#13

What does 'db_debug' => (ENVIRONMENT !== 'production') in database.php do? Does this set the ENVIRONMENT constant, so if I launch an application I could just change this to 'db_debug' => (ENVIRONMENT == 'production')?
Reply
#14

This does not set the environment. It sets the 'db_debug' value to the results of the check. The check itself will be TRUE if the the environment is anything other than 'production'. ENVIRONMENT itself is set in the index.php file.
Reply
#15

Sorry if this might be off-topic, but under what circumstances would I change this?
Reply
#16

Since that setting only determines whether the database error screen is shown or not, I would never want it to show in production. You might alter it not to show in staging servers, or the like, but that's about the only use I can think of for it.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB