开发者

Multi Stage with Zend Framework - If we need a ROOT_DIR defined, can we have it on application.ini?

On our application.ini file we have set two environment variables: development and production.

All database details for each ENV are configured there.

Is it ok and possible to define our ROOT_DIR for each environment on application.ini as well ?

Update:

At the moment on my zend project roots, I have a file called

config_root.php

and, there I have:

define('ROOT_DIR',"/home/myuser/www/www");

Every time I have to switch from development to production, I have to recall to NOT overwrite this same file on the production side, because there, this file is different, and like so instead:

define('ROOT_DIR',"/home/productionuser/public_html/");

This config_root method is something that I've used. At this moment, I'm trying to change how things work around here, and, so I've defined some document roots on my apache configurations. (something that I didn't before).

So, and before continue, a question arrives:

1 - Since I'm using apache do开发者_如何学Ccument root configuration, can I, perhaps, drop this ROOT_DIR definition?

If I still have to use this ROOT_DIR definition, then:

2 - Can we deal with this inside application.ini and remove the need for config_root.php ?

Thanks


Answering your questions:

  1. Since I'm using apache document root configuration, can I, perhaps, drop this ROOT_DIR definition?

Yes, I would think so. You said you have config_root.php in the root directory of each of your ZF projects, so can't you just set ROOT_DIR to ./ (or possibly ./public if that's what you're trying to get to.

As an example, the default public/index.php that Zend_Tool creates includes this line:

defined('APPLICATION_PATH') || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));

this sets a constant APPLICATION_PATH with the full path to the current project's application directory, without this path having to be hard-coded in.

2 - Can we deal with this inside application.ini and remove the need for config_root.php ?

I'm not sure if application.ini is the right place for it, but you certainly don't need a separate config_root.php file. If you can use a relative path as in my example above you should be able to build it into your application code without needing separate values for production and development.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜