If you look at the index.php
file that comes with ZF, this should answer most of these questions.
The APPLICATION_PATH
constant is defined in index.php
, and this also creates a Zend_Application
object that simply loads the application and launches it.
There are two ways to tell your Zend_Application
where your boot block is located in ZF1.
The first method (explicitly installed):
$application = new Zend_Application( APPLICATION_ENV, array( 'bootstrap' => array( 'class' => 'Bootstrap', 'path' => APPLICATION_PATH . '/Bootstrap.php', ), 'config' => APPLICATION_PATH . '/configs/application.ini', ) );
In the above example, the bootstrap class and bootstrap script are passed as part of the $options
constructor directly to Zend_Application
along with the application.ini
file.
If you put the bootstrap class and the script in your application.ini
file, you can initialize Zend_Application
as follows:
$application = new Zend_Application( APPLICATION_ENV, array('config' => APPLICATION_PATH . '/configs/application.ini') );
Zend_Application
will process the application.ini
file and collect Bootstrap information from there.
Then you can call $application->bootstrap()->run();
to run the application.
To answer your questions:
- The boot application configures your application. After processing your
ini
file, this is the first thing to do. This installs all the necessary components for your ZF application (e.g. Front Controller, Zend_View, Layouts, DB connection, etc.). - index.php copies it at the very beginning at the very beginning.
APPLICATION_PATH
defined directly in index.php
source share