CodeIgniter Forums
Why is my ENVIRONMENT constant, "development" if my codeigniter app is online? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Installation & Setup (https://forum.codeigniter.com/forumdisplay.php?fid=9)
+--- Thread: Why is my ENVIRONMENT constant, "development" if my codeigniter app is online? (/showthread.php?tid=69777)



Why is my ENVIRONMENT constant, "development" if my codeigniter app is online? - desbest - 01-16-2018

Why is my ENVIRONMENT constant, "development" if my codeigniter app is online, not on localhost?
What is going on? How do I fix it?


RE: Why is my ENVIRONMENT constant, "development" if my codeigniter app is online? - Elias - 01-16-2018

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/general/environments.html


RE: Why is my ENVIRONMENT constant, "development" if my codeigniter app is o... - desbest - 01-16-2018

I just changed the line on index.php to read


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



RE: Why is my ENVIRONMENT constant, "development" if my codeigniter app is o... - dave friend - 01-16-2018

(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');