Quote:
Originally Posted by gog
First you have to make sure you can navigate to the error controller with your browser via http://localhost/error/error or http://localhost/default/error/error
If you get an "Object not found" error than you have to check your Apache httpd.conf and comment out:
# Multi-language error messages
#Include conf/extra/httpd-multilang-errordoc.conf
because of this directive Apache maps /error to path_to_your_apache_installation/error folder, and not through the .htaccess file to index.php
After you are sure that you ErrorController is working (you also need a scripts/error/error.phtml file), and it' accessible just make sure that you haven't set $frontController->throwExceptions(true) on your Front Controller, because it disables the ErrorHandler controller plugin.
p.s.
You don't need to register Zend_Controller_Plugin_ErrorHandler () with the Front controller using something like $frontController->registerPlugin (new Zend_Controller_Plugin_ErrorHandler ()); because the Zend_Controller_Plugin_ErrorHandler () is enabled by default.
Hope this helps...
|
Hi mate,
thanks heaps for the response, did everything you mentioned. I can access my error controller directly and it displays fine but it just doesn't get wanna wake up to an error.
Below is what my front controller looks like:
Code:
<?php
error_reporting(E_ALL|E_STRICT);
set_include_path(
'.' . PATH_SEPARATOR . '../../libraries'
. PATH_SEPARATOR . '../../systems/admin/models'
. PATH_SEPARATOR . '../../access/admin/widgets'
. PATH_SEPARATOR . '../../elements'
. PATH_SEPARATOR . get_include_path());
include "Zend/Loader.php";
Zend_Loader::registerAutoload();
$systemConfig = new Zend_Config_Ini('../../../configuration/system.ini', 'development');
$registry = Zend_Registry::getInstance();
$registry->set('system_config', $systemConfig);
$db = Zend_Db::factory($systemConfig->db);
Zend_Db_Table::setDefaultAdapter($db);
Zend_Registry::set('db', $db);
$frontController = Zend_Controller_Front::getInstance();
$frontController->setControllerDirectory('../../systems/admin/controllers');
$router = $frontController->getRouter();
$router->addRoute('app', new Zend_Controller_Router_Route('apps/:appname', array('controller' => 'apps', 'action' => 'index')));
Zend_Layout::startMvc(array('layoutPath'=>'../../systems/admin/layouts'));$frontController->dispatch();
But when I try a non-existent path 'mysite/fakecontroller' to invoke the error controller I see: Fatal error: Uncaught exception 'Zend_Controller_Dispatcher_Exception' with message 'Invalid controller specified (fakecontroller)' in ...
Can you please send me a working implementation of error controller? thanks.