I am trying to create application with Zend framework so I have created basic application structure with zf tool.
Now when I try to start application with http://localhost/zendApp/public/index.php the default "Welcome to the Zend Framework!" page loads.
But when I type http://localhost/zendApp/public/ or 开发者_如何学Gohttp://localhost/zendApp/public/index index controller is not invoked, but rather I get error message:
*Invalid controller specified (zendApp)
array (
'controller' => 'zendApp',
'action' => 'public',
'module' => 'default',
)
As you see, it is trying to start the controller with the name of application. Also if I create additional actions in index controller and call it with http://localhost/zendApp/public/index/newaction I get the same error:
array ( 'controller' => 'zendApp', 'action' => 'public', 'index' => 'newaction', 'module' => 'default', )
Can you help me understand why index controller is not invoked? Thanks.
The url for your controllers would not include the public folder. Eg UserController would be http://localhost/zendApp/user/ not http://localhost/zendApp/public/user, and your index controller should work on http://localhost/zendApp/ or http://localhost/zendApp/index.
Your url rewiter (eg mod_rewrite) should be set up to rewrite all urls to /public/index.php other than static files eg images, css js etc. see here
Do you have this setup: "If you are deploying to a "user" site (e.g. http://localhost/~rob), then you need a RewriteBase line in your .htaccess file that looks something like: RewriteBase /~rob/zf-tutorial/public/" from here
精彩评论