Php – Zend Framework – ErrorHandler does not seem to be working as expected


This is my first experience using the Zend Framework. I am attempting to follow the Quick Start tutorial. Everything was working as expected until I reached the section on the Error Controller and View. When I navigate to a page that does not exist, instead of receiving the error page I get the Fatal Error screen dump (in all it's glory):

Fatal error: Uncaught exception 'Zend_Controller_Dispatcher_Exception'
with message 'Invalid controller specified (error)' in
Stack trace: #0
Object(Zend_Controller_Response_Http)) #1
Zend_Controller_Front->dispatch() #2 {main} thrown in
on line 249

I do not believe this is caused by a syntax error on my part (a copied and pasted the example file's content from the tutorial) and I believe I have the application directory structure correct:


And finally, the IndexController and index.phtml view does work.

Best Solution

You have ErrorHandler.php. It should be ErrorController.php. Controllers all need to be named following the format of NameController.php. Since you don't have it named properly the dispatcher cannot find it.

Related Question