Am using Zend framework along with zend studio. Am confused with following files
1)Bootsrap.php
2).htaccess
3)application.ini
4) index.php
I have edited all these files to run my applicaiton on Virtaul host. However I have confused with above mentioned file, as which code goes in which file.
Also Am getting error, when I created new project using zend studio
"Uncaught exception 'Zend_Application_Bootstrap_Exception' with message 'No default controller directory registered with front controller' in"
if you can give some guidelines on the above will be great
Thanks,
index.php
is the PHP script that acts as the gateway to your entire application. This script creates your Zend_Application
, bootstraps it and runs it.
.htaccess
is used by Apache to route all requests to non-existent files and directories to your index.php
script so that Zend Framework can handle the URLs and route them to the appropriate module, controller and action.
Bootstrap.php
can be used to write blocks of code to bootstrap (set up) require parts of your application (e.g. database connection, sessions, paths etc). The bootstrap is called almost immediately after your application starts running and before any routing, dispatching or anything takes place.
application.ini
is also used to configure your application. Much of what can be done in the Bootstrap.php
file can be done in the application.ini
file. There are a number of resource plugins available that can take configuration in your application.ini
file and set up specific aspects of your application.
Most of what you can do using PHP code in your Bootstrap, can also be done in application.ini
using ini
notation instead of code, which is often easier for certain people to maintain.
The Zend Framework MVC Theory of Operation covers some points of interest that I think would be helpful in understanding the bootstrap process.
To resolve the error you are getting, try adding this line to your application.ini
:
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
This makes use of the aforementioned resource plugins, in specific the FrontController
resource plugin which sets up the front controller.