How to change the ENVIRONMENT type - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6) +--- Forum: CodeIgniter 3.x (https://forum.codeigniter.com/forumdisplay.php?fid=17) +--- Thread: How to change the ENVIRONMENT type (/showthread.php?tid=1665) |
How to change the ENVIRONMENT type - lionking - 03-31-2015 When open the index.php file to change the ENVIRONMENT type I have found the following: PHP Code: define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'development'); In the previous CI version was as the following: PHP Code: define('ENVIRONMENT', 'development'); And I could change the environment by replace "development" word to ("production" or "testing"). How can I do that in CI 3 ? RE: How to change the ENVIRONMENT type - Muzikant - 03-31-2015 For production: PHP Code: define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'production'); For testing: PHP Code: define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'testing'); For development: PHP Code: define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'development'); RE: How to change the ENVIRONMENT type - Narf - 03-31-2015 In the same way. RE: How to change the ENVIRONMENT type - lionking - 03-31-2015 If I can change it whether PHP Code: define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'testing'); // testing, production, development Or PHP Code: define('ENVIRONMENT', 'development'); // testing, production, development What is the benefit of the following condition PHP Code: isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] RE: How to change the ENVIRONMENT type - Muzikant - 03-31-2015 (03-31-2015, 06:52 AM)lionking Wrote: What is the benefit of the following condition I think, as a CodeIgniter user you do not have to care about it. RE: How to change the ENVIRONMENT type - lionking - 03-31-2015 I have found the answer of my question. http://bldn.se/post/codeigniter-introduces-_serverci_env http://www.patpohler.com/codeigniter-multiple-environments RE: How to change the ENVIRONMENT type - Narf - 03-31-2015 If you don't use the CI_ENV variable (which I'm guessing you're not), then there's no benefit from it. As I said - you can do it as previously just fine ... whether you remove the condition or not doesn't make a practical difference. RE: How to change the ENVIRONMENT type - alenn - 04-05-2015 Code: if(! defined('ENVIRONMENT') ) I'm using the above code for my application. Hope it helps |