Hi all,

I'm having some routing problems which I don't necessarily think the group are going to be able to answer directly, but maybe give me some pointers as to how I may debug further.

I have developed a site on my local machine where everything is working just fine. Yesterday I copied the site over to a second development server for my colleagues to start reviewing. However, on the development server I'm getting an awful lot of Zend_Controller_Dispatcher_Exception exceptions thrown with the message 'Invalid controller specified (<controller name>).

I say an awful lot as not every request results in this. My default index controller works fine, as does my Book controller, but all others fail (please note that book controller is the real thing, and not a typical library book example file! Its part of a booking process). My directory structure is as follows:

www/application/
www/application/config/
www/application/modules/
www/application/modules/default/
www/application/modules/default/controller/
www/application/modules/default/controller/BookController.php
www/application/modules/default/controller/ComingSoonController.php
www/application/modules/default/controller/IndexController.php
www/application/modules/default/controller/StaticPagesController.php
www/application/modules/default/views/
www/application/templates/
www/htdocs/ <- doc root

As I say, the BookController and IndexController work fine, but ComingSoonController and StaticPagesController are not found.

During a request for /comingsoon/index the request object looks like this:

2007-08-15T08:03:32+01:00 DEBUG (7): Zend_Controller_Request_Http Object
(
    [_requestUri:protected] => /default/ComingSoon/index/
    [_baseUrl:protected] =>
    [_basePath:protected] =>
    [_pathInfo:protected] => /default/ComingSoon/index/
    [_params:protected] => Array
        (
            [module] => default
            [controller] => ComingSoon
            [action] => index
        )

    [_aliases:protected] => Array
        (
        )

    [_dispatched:protected] => 1
    [_module:protected] => default
    [_moduleKey:protected] => module
    [_controller:protected] => ComingSoon
    [_controllerKey:protected] => controller
    [_action:protected] => index
    [_actionKey:protected] => action
)

So the correct modules, controller and action parameters are being taken from the URL.

All the controllers are working fine with exactly the same code on a local development machine. The only real difference being the the development machine has a local hostname and uses Apache Virtual Hosts, whereas the new testing server on which the site fails is accessed over the internet via its IP address. There is no domain registered against it.

Some relevant lines from my bootstrap:

// Get front controller
$controller = Zend_Controller_Front::getInstance();

$modules = array('default',"$modulesDir/default/controller/");

$controller->setControllerDirectory($modules);

***** NOTE THE ABOVE LINES HAVE BEEN ADDED TO TRY AND RESOLVE THE ISSUE, THEY WERE NOT REQUIRED ON THE WORKING SERVER *********

// Add some additional routes - if we keep these they should come from a config
$router = $controller->getRouter();
$router->addRoute('shows', new Zend_Controller_Router_Route ('shows/:event',
        array('controller'=>'findashow','action'=>'showInfo')));
$router->addRoute('InsiderTips',new Zend_Controller_Router_Route ('insidertips/:article',
        array('controller'=>'staticPages',
                'artion'=>'index',
                'article'=>'insidertips',
                'category'=>'insidertips')));
$router->addRoute('whyus',new Zend_Controller_Router_Route ('whyus/:article',
        array('controller'=>'staticPages',
                'artion'=>'index',
                'article'=>'whyus',
                'category'=>'whyus')));
$router->addRoute('whybookapackage',new Zend_Controller_Router_Route ('whybookapackage/:article',
        array('controller'=>'staticPages',
                'artion'=>'index',
                'article'=>'whybookapackage',
                'category'=>'whybookapackage')));

Could anyone suggest any where I might start looking and debugging further? Perhaps somewhere where the actual path to the action controller is generated and an attempt is made to instantiate the class might give me some clues as to what's going wrong?

--
Greg Frith
[EMAIL PROTECTED] : +44 7970 925 257

MSN: [EMAIL PROTECTED]
Jabber: [EMAIL PROTECTED]
Skype: gregfrith



Reply via email to