# Getting Zend Framework Working



## bryantms (Jul 13, 2007)

Hi all - I'm working through the book Practical Web 2.0 Applications with PHP and have run into an issue. I am trying to install the main Controllers to handle the site. I have tried to implement an IndexController as follows

IndexController.php

```
<?php
    class IndexController extends CustomControllerAction
    {
        public function indexAction()
        {
        }
    }
?>
```
This extends CustomControllerAction.php:


```
<?php
    class CustomControllerAction extends Zend_Controller_Action
    {
        public $db;

        function init()
        {
            $this->db = Zend_Registry::get('db');
        }
    }
?>
```
I'll also include .htaccess:


```
RewriteEngine on
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1
```
And I'll include settings.ini:


```
[development]

database.type       = pdo_mysql
database.hostname   = localhost
database.username   = phpweb20
database.password   = myPassword (obviously changed)
database.database   = phpweb20

paths.base      = /var/www/phpweb20
paths.data      = /var/www/phpweb20/data
paths.templates = /var/www/phpweb20/templates

logging.file = /var/www/phpweb20/data/logs/debug.log
```
The error I am receiving when I implement all of these is as follows:

Fatal error: Uncaught exception 'Zend_Controller_Dispatcher_Exception' with message 'Invalid controller specified (error)' in /var/www/phpweb20/include/Zend/Controller/Dispatcher/Standard.php:241 Stack trace: #0 /var/www/phpweb20/include/Zend/Controller/Front.php(934): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) #1 /var/www/phpweb20/htdocs/index.php(18): Zend_Controller_Front->dispatch() #2 {main} thrown in /var/www/phpweb20/include/Zend/Controller/Dispatcher/Standard.php on line 241

Has anyone experienced similar problems? Does anyone have any idea on how to solve this? Any help is appreciated. Thanks!


----------



## bryantms (Jul 13, 2007)

I've been doing quite a bit of research on this so far and found this page of frequently encountered problems with Zend Framework: http://framework.zend.com/wiki/display/ZFUSER/Frequently+Encountered+Problems

It suggests:

You haven't set up an ErrorController to catch errors. By default the framework has a front controller plugin that tries to send all exceptions to a special controller (ErrorController in the default module). There's a sample error controller, and more information on the plugin, in the manual.

Anyone have any idea about how implement this ErrorController. I haven't found anything that works yet.


----------

