Codeigniter development environment is not setting. I always use this code in index.php. but i don’t understand why i am getting “production” as output while i am working on localhost.
switch(dirname(__FILE__)){ case "H:wampwwwsitedirectory": define('ENVIRONMENT', 'development'); break; default: define('ENVIRONMENT', 'production'); break; } echo ENVIRONMENT ; // output is "production" while i am on localhost echo dirname(__FILE__) ; // output is "H:wampwwwsitedirectory"
Advertisement
Answer
That’s strange. It did the exact same thing for me. Could you try something like this?
switch($_SERVER["HTTP_HOST"]){ case "localhost": define('ENVIRONMENT', 'development'); break; default: define('ENVIRONMENT', 'production'); break; } echo ENVIRONMENT ; // output development