b_dubb
b_dubb

Reputation: 421

configure apache for Zend Framework (1.12) project on Mac OS X Lion

I've got a ZF 1.12 project installed on Mac OS X Lion. When I point my browser to ... http://localhost/~myusername/zendproj/public/index/index ... it loads the page as expected. it also works for other actions within the Index controller. Ex: http://localhost/~myusername/zendproj/public/admin/index

When I view other controllers ... http://localhost/~myusername/zendproj/public/admin/index ... I get this error

An error occurred
Page not found
Exception information:

Message: Invalid controller specified (~name)
Stack trace:

#0 /usr/local/zend/share/ZendFramework/library/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#1 /usr/local/zend/share/ZendFramework/library/Zend/Application/Bootstrap/Bootstrap.php(97): Zend_Controller_Front->dispatch()
#2 /usr/local/zend/share/ZendFramework/library/Zend/Application.php(366): Zend_Application_Bootstrap_Bootstrap->run()
#3 /Users/myusername/Sites/zendproj/public/index.php(26): Zend_Application->run()
#4 {main}  

Request Parameters:

array (
    'controller' => '~myusername',
    'action' => 'zendproj',
    'public' => 'admin',
    'module' => 'default',
)

why would my vhost/.htaccess config work for one controller but not the other? thanks

Upvotes: 0

Views: 600

Answers (1)

drew010
drew010

Reputation: 69977

The Apache mod_userdir path is confusing the router.

Since I would assume in your production environment the ZF app will not be accessed out of a user folder (~user), I'd suggest setting up a dummy host entry so you can access your app locally using a hostname.

Edit /private/etc/hosts and add an entry like:

127.0.0.1    zendapp www.zendapp

Then try accessing http://zendapp to load your application.

Depending on how Apache is set up, you may need to create a vhost for zendapp that points to your application's public folder, or just add a ServerAlias to an existing vhost so Apache recognizes the hostname.

Upvotes: 1

Related Questions