简体   繁体   中英

Zend Config doesn't load settings from application.ini [development : production] part

I have a application.ini file in /application/configs directory.

I have in configuration file (beside other options) parts like:

[production]

resources.db.params.username = "someuser1"

dmp.server.baseUrl = "http://someurl1.com"

[staging : production]

[testing : production]

[development : production]

resources.db.params.dbname = "someuser2"

dmp.server.baseUrl = "http://someurl2.com"

I'm loading config file in Bootstrap.php

protected function _initConfig() {
    $config = new Zend_Config($this->getOptions(), TRUE);
    Zend_Registry::set('config', $config);
    return $config;
}

In .htaccess file I have set up an environment:

SetEnv APPLICATION_ENV development
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
RewriteBase /

When i try to get variable from $config->dmp->server->baseUrl i Receive value: http://someurl1.com

Why? It should give me value: http://someurl2.com

I'm using Zend 1.12

change

protected function _initConfig() {
    $config = new Zend_Config($this->getOptions(), TRUE);
    Zend_Registry::set('config', $config);
    return $config;
}

to

protected function _initConfig() {
    $config = $this->getOptions();
    Zend_Registry::set('config', $config);
    return $config;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM