CodeIgniter Forums

Full Version: how set CI_ENV for codeigniter
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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?
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
(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
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.
(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
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
(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.