CodeIgniter Forums
how set CI_ENV for codeigniter - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forum-5.html)
+--- Forum: General Help (https://forum.codeigniter.com/forum-24.html)
+--- Thread: how set CI_ENV for codeigniter (/thread-74247.html)



how set CI_ENV for codeigniter - omid_student - 09-03-2019

Hi
According to CI_ENV parameter,we can change environment codeigniter
define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'development');

But how i can set this variable on host?


RE: how set CI_ENV for codeigniter - InsiteFX - 09-03-2019

Add this to the top of your .htaccess file in the root.

PHP Code:
SetEnv CI_ENV development
#SetEnv CI_ENV production 

Un-remark and remark the one you to use


RE: how set CI_ENV for codeigniter - omid_student - 09-03-2019

(09-03-2019, 02:50 AM)InsiteFX Wrote: Add this to the top of your .htaccess file in the root.

PHP Code:
SetEnv CI_ENV development
#SetEnv CI_ENV production 

Un-remark and remark the one you to use
Thank you it's working good


RE: how set CI_ENV for codeigniter - dave friend - 09-03-2019

If you are in control of the webserver it is better to use server config files than to use .htaccess. In truth, there really isn't a reason to use .htaccess at all because all directive will be supplied much more efficiently from config files.

.htaccess hits tend to add up because each time the server read a directory it must open and evaluate the .htaccess file if it is there. Config files, on the other hand, are read once when the web server starts up and the directives are kept in memory.

.htaccess exists to allow purchasers of space on a shared server at least at tiny be of control. But it's performance sucking sponge.


RE: how set CI_ENV for codeigniter - omid_student - 09-03-2019

(09-03-2019, 06:58 AM)dave friend Wrote: If you are in control of the webserver it is better to use server config files than to use .htaccess. In truth, there really isn't a reason to use .htaccess at all because all directive will be supplied much more efficiently from config files.

.htaccess hits tend to add up because each time the server read a directory it must open and evaluate the .htaccess file if it is there. Config files, on the other hand, are read once when the web server starts up and the directives are kept in memory.

.htaccess exists to allow purchasers of space on a shared server at least at tiny be of control. But it's performance sucking sponge.
Thank you so much


RE: how set CI_ENV for codeigniter - Goldberg - 01-28-2020

Setting up CodeIgniter multiple environments is fairly easy and supported by default in the framework. However it requires you to define your environment in a core file instead of setting it up to recognize the url which can cause several issues McDVOICE


RE: how set CI_ENV for codeigniter - tommyshelbyop - 04-14-2021

(01-28-2020, 04:22 AM)Goldberg Wrote: Setting up CodeIgniter multiple environments is fairly easy and supported by default in the framework. However it requires you to define your environment in a core file instead of setting it up to recognize the url which can cause several issues mcdvoice
mybkexperience
CodeIgniter, while not as new as other PHP frameworks, is still a great platform for developing client web applications. One thing we do for every project at Anecka is configure a local, stage and production environment. This helps us a lot when we have to maintain the project after launch as we have separate environments for developing and testing features. CodeIgniter is great because it supports multiple environments out of the box.