CodeIgniter Forums

Full Version: Why is my ENVIRONMENT constant, "development" if my codeigniter app is online?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Why is my ENVIRONMENT constant, "development" if my codeigniter app is online, not on localhost?
What is going on? How do I fix it?
Look at index.php file in your webroot directory. Env variable passing from webserver (apatche, nginx etc). Or you can define it manual...

also you may visit this page https://www.codeigniter.com/user_guide/g...ments.html
I just changed the line on index.php to read


PHP Code:
define('ENVIRONMENT', isset($_SERVER['ENVIRONMENT']) ? $_SERVER['ENVIRONMENT'] : 'development'); 
(01-16-2018, 01:46 PM)desbest Wrote: [ -> ]I just changed the line on index.php to read

PHP Code:
define('ENVIRONMENT', isset($_SERVER['ENVIRONMENT']) ? $_SERVER['ENVIRONMENT'] : 'development'); 

I've had several cases in Apache shared hosting setups where mod_env was not enabled. The following takes care of those
by assuming that if $_SERVER['CI_ENV'] is not set (as it should have been in .htaccess) it's because we're on the live site.

PHP Code:
define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'production');