1

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

sanneo
  • 365
  • 4
  • 15

1 Answers1

1

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;
}
Thanh Nguyen
  • 5,174
  • 11
  • 43
  • 74
  • 1
    Thanks for proposition, you pointed me to solution. There was a problem with "config" index, when I changed it to "appConfig" (or any other), the correct value has been loaded. – sanneo Nov 11 '13 at 09:30