Changes
Title
unchanged
Manage application configuration in different modes
Category
unchanged
Tutorials
Yii version
unchanged
Tags
changed
config, deployment
Content
changed
Manage application configurations
> Info: This tutorial references the idea presented in [Jonah's excellent blog article](http://php-thoughts.cubedwater.com/2008/running-your-yii-app-and-configuring-it/).
Application configuration determines how an Yii application should behave, because it is the only parameter passed in the entry script. An application, on the other hand, needs to behave differently under different circumstances. For example, an application may need different configurations when running in production mode, development mode and testing mode; In a team development environment, each developer may have his own database connection and thus require a customized application configuration. In this tutorial, we describe how to manage application configurations to fulfill all the above needs.[...]
In a team development environment managed with some source control system (e.g. SVN, CVS, GIT), each developer may want to have his own application configuration (e.g. because he may have a different DB connection setting). In this case, we should only store `main.php` in the repository. The rest of the configuration files should only be kept in each developer's file system to avoid conflict of development configuration changes.
> Tip: The same technique may also be applied to other PHP-based configurations. For example, if we store application parameters (accessed via `Yii::app()->params`) in a PHP file, we can use the above technique to customize parameters in different modes.
### Links
[Russian Version](http://dbhelp.ru/manage-application-configuration/page/)
[Chinese Version](http://www.yiiwiki.com/wiki/view/id/17/title/%E7%AE%A1%E7%90%86%E4%B8%8D%E5%90%8C%E6%A8%A1%E5%BC%8F%E4%B8%8B%E5%BA%94%E7%94%A8%E7%A8%8B%E5%BA%8F%E7%9A%84%E9%85%8D%E7%BD%AE)