diff options
Diffstat (limited to 'user_guide/libraries/config.html')
-rw-r--r-- | user_guide/libraries/config.html | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/user_guide/libraries/config.html b/user_guide/libraries/config.html index 6b48b2515..98b6052a9 100644 --- a/user_guide/libraries/config.html +++ b/user_guide/libraries/config.html @@ -150,6 +150,23 @@ $site_name = $blog_config['site_name'];</code> <p>Where <var>item_name</var> is the $config array index you want to change, and <var>item_value</var> is its value.</p> +<h2>Environments</h2> + +<p>You can set the environment of you application and load config items depending on the current environment. It also disables PHP from displaying errors in environments other than development. To set your environment, open <strong>index.php</strong>, located at the root and change the <var>ENVIRONMENT</var> constant. By default, there is support for a development, test and production environment.</p> + +<code> +define('<var>ENVIRONMENT</var>', '<var>development</var>'); +</code> + +<p>To make a config file environment-aware, copy the file from <samp>application/config/</samp> to <samp>application/config/development/</samp>, depending on the environment the config file belongs to. You can place the following configuration files in environment folders:</p> + +<ul> +<li>Default config files</li> +<li>Database config files</li> +<li>Custom config files</li> +</ul> + +<p><strong>Note:</strong> CodeIgniter always tries to load the config file for the current environment first. If the file does not exist, the global config file (i.e. <samp>application/config/</samp>) is loaded. This means you are not obligated to place <strong>all</strong> your config files (but rather the files that change per environment) in an environment folder.</p> <h2>Helper Functions</h2> |