blob: 40725febae1a6ca03745be608f9523c191dd530d [file] [log] [blame]
Derek Jones8ede1a22011-10-05 13:34:52 -05001##############################
2Handling Multiple Environments
3##############################
4
5Developers often desire different system behavior depending on whether
6an application is running in a development or production environment.
7For example, verbose error output is something that would be useful
8while developing an application, but it may also pose a security issue
9when "live".
10
11The ENVIRONMENT Constant
12========================
13
14By default, CodeIgniter comes with the environment constant set to
15'development'. At the top of index.php, you will see::
16
17 define('ENVIRONMENT', 'development');
18
19In addition to affecting some basic framework behavior (see the next
20section), you may use this constant in your own development to
21differentiate between which environment you are running in.
22
23Effects On Default Framework Behavior
24=====================================
25
26There are some places in the CodeIgniter system where the ENVIRONMENT
27constant is used. This section describes how default framework behavior
28is affected.
29
30Error Reporting
31---------------
32
33Setting the ENVIRONMENT constant to a value of 'development' will cause
34all PHP errors to be rendered to the browser when they occur.
35Conversely, setting the constant to 'production' will disable all error
36output. Disabling error reporting in production is a :doc:`good security
37practice <security>`.
38
39Configuration Files
40-------------------
41
42Optionally, you can have CodeIgniter load environment-specific
43configuration files. This may be useful for managing things like
44differing API keys across multiple environments. This is described in
45more detail in the environment section of the `Config
46Class <../libraries/config.html#environments>`_ documentation.