Question: How to implement different configs for development, production etc?
-
Added following line in .htacess (Location: /public/.htaccess)
SetEnv APPLICATION_ENV development
This is for development. - Open application.config.php in /config/application.config.php
-
Get the current environment.
$applicationEnv = getenv('APPLICATION_ENV');
Dynamic the file like below:'config_glob_paths' => array( "config/autoload/{,*.}{$applicationEnv}.php" )
- Create the config files like below in /config/autoload
development.php production.php
-
Below are the sample of config file.
return array( 'db' => array( 'driver' => 'Pdo', 'dsn' => 'mysql:dbname=DBNAME;host=HOST', 'username' => 'DB_USERNAME', 'password' => 'DB_PASSWORD' ) );
Please update the database credentials.