Er. Sujeet Kumar
Er. Sujeet Kumar

Reputation: 41

CodeIgniter3: $_SERVER['CI_ENV'] not able to set of configured

Unable to set the environment of the CodeIgniter-3 framework. Please help.

I see that in their default installation, their index.php has this. Nothing is mention where to set the ENVIRONMENT value.

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

Why would CI_ENV ever already be set within the $_SERVER array?

Upvotes: 1

Views: 1169

Answers (1)

Er. Sujeet Kumar
Er. Sujeet Kumar

Reputation: 41

Steps :

I : First create .htaccess file in the root of the project, parallel to index.php file.

II : Paste these code in .htaccess file.

<IfModule mod_rewrite.c>
  SetEnv CI_ENV development # For Developement
  #SetEnv CI_ENV testing     # For Testing
  #SetEnv CI_ENV production  # For Production
</IfModule>

III : If mod_rewrite is not enabled then first enable it.

IV : Now run the project. You will get desired output.

Upvotes: 3

Related Questions