I've the next on my small htaccess.

SetEnv APPLICATION_ENV development

After I pass this file to prodution, I'll change it out to:

SetEnv APPLICATION_ENV production

This

development

and

production

are positioned on Zend Framework application.ini correct ?

So how exactly does Zend and Apache communicate here? So how exactly does Zend is aware of that htaccess instruction?

Thanks.

SetEnv, utilized in Apache's configuration (whether it's a .htaccess file, or perhaps a VirtualHost), defines an atmosphere variable.

From PHP, read atmosphere variables either :


Considering the given index.php in Zend Frameworks QuickStart, you will see it uses that atmosphere variable the define the PHP constant known as APPLICATION_ENV :

// Define application environment
defined('APPLICATION_ENV')
    || define('APPLICATION_ENV',
              (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV')
                                         : 'production'));

Which constant is later accustomed to initialize the applying :

// Create application, bootstrap, and run
$application = new Zend_Application(
    APPLICATION_ENV,
    APPLICATION_PATH . '/configs/application.ini'
);

The flow of communication, while you refer to it as, may be the followoing:

If you are using

SetEnv APPLICATION_ENV production

inside your .htaccess, the atmosphere you place there, is going to be used. Why?

The next bit of code out of your index.php does not define the continual, if it's been defined already, the situation, if you are using SetEnv inside your .htaccess.

// Define application environment
defined('APPLICATION_ENV')
    || define('APPLICATION_ENV',
              (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV')
                                         : 'production'));

In case your .htaccess does not define the continual, the worthiness provided within the index.php is going to be used. Personally, I'd still ensure that it stays synchronized. Because you possibly can make mistakes like failing to remember to create AllowOverride for the vhost which may create a situation in which the atmosphere is placed through the index.php despite the fact that the .htaccess exists.