I do this very thing. The only requirement is that you have access to setting apache environment variables.

Essentially, I have this in my development vhost:

SetEnv APPLICATION_STATE development

My bootstrap file reads the environment variables to determine what section of the config to read. If the state is development (explicitly set only in the dev environment), then it only reads the development config. Otherwise, it defaults to 'production'.

I have an example here:

http://svn.ralphschindler.com/repo/RalphSchindler/trunk/httpdocs/index.php

and config here:

http://svn.ralphschindler.com/repo/RalphSchindler/trunk/application/config/config.ini.orig

Thats essentially it, I also use the const APPLICATION_STATE elsewhere in my application if need be.

-ralph

Stephan Stapel wrote:
Have a look at Zend_Config (http://framework.zend.com/manual/en/zend.config.adapters.ini.html <http://framework.zend.com/manual/en/zend.config.adapters.ini.html>).

I am already using the config classes. I was just asking myself if someone has best practises on using these classes.

In fact, I'm already using Zend_Config_Xml with multiple sections, one for each environment.

Is this the path that you'd also sugggest to take? And how to best decide which section is correct? Based on the $_SERVER['HTTP_POST'] value? Or are there better alternatives?

Regards,

Stephan


Reply via email to