views:

213

answers:

2

I've tried to run ZF Quickstart app not from the root folder, but from webserver subfolder, like a usual php app, e.g. localhost/quickstart. When localhost/quickstart/guestbook gives page not found error:

> Page not found
> 
> array(3) {   ["controller"]=>  
> string(10) "quickstart"   ["action"]=>
> string(9) "guestbook"   ["module"]=>  
> string(7) "default" }

It treats parent folder name as controller name. I've narrowed down my problem to this line:

Zend_Controller_Front::getInstance()->dispatch();

SHould I somehow condigure the router object to avoind parent folder confusion? What code should I use?

My meta-purpose is to run a few zend apps on the same webserver.

A: 

You probably need to set the base url.

For example:

$controller->setControllerDirectory('./application/controllers')
       ->setRouter($router)
       ->setBaseUrl('/quickstart');
Greg
That did it, thanks a million.
PHP thinker
A: 

You say:

I've tried to run ZF Quickstart app not from the root folder, but from webserver subfolder,

Which is not necessarily the same thing as:

My meta-purpose is to run a few zend apps on the same webserver.

What RoBorg says is true, and specifically answers your first question, but it's a pain to have to do that for every site (plus it means the routing on dev and deployed sites is not the same), when what you'd really like is to be able to have all your project URLs set up with their own subdomains so they can run at the top-level, without you having to touch any config or routing. It just so happens that I wrote a blog post on this just recently...