php - Route fail to work after migrate and upgrade for ZF2 -
there 3 modules in app/modules/, named application, album, shop. want access each of these modules using hostanme/application, hostname/album, , hostname/shop. application modules, configuration is:
'router' => array( 'routes' => array( 'application' => array( 'type' => 'literal', 'options' => array( 'route' => '/application', 'defaults' => array( '__namespace__' => 'appliwcation\controller', 'controller' => 'index', 'action' => 'index', ), ), 'may_terminate' => true, 'child_routes' => array( 'default' => array( 'type' => 'segment', 'options' => array( 'route' => '/[:controller[/:action]]', 'constraints' => array( 'controller' => '[a-za-z][a-za-z0-9_-]*', 'action' => '[a-za-z][a-za-z0-9_-]*', ), 'defaults' => array( ), ), ), ), ), ), ), 'controllers' => array( 'invokables' => array( 'application\controller\index' => 'application\controller\indexcontroller', ......... ), },...
there multiple controllers under application module. via method, can accessed url like: http://www.myhostname.com/application/controllername/actionname similar configuration other 2 modules.
this works previous t61 thinkpad @ beginning of last month. reinstalled php/apache in new bought t410. git pull latest zf2 version:
git log commit 73e0de644789aa5b712c97f55c512c57c2b9ac76 merge: 7c65991 d722da5 author: matthew weier o'phinney <matthew@zend.com> date: fri oct 4 11:01:06 2013 -0500 merge branch 'hotfix/version-composer' fix issue introduced #5191
but not work anymore. checked error.log:
[sun oct 06 10:47:05 2013] [error] [client 127.0.0.1] file not exist: /path/to/app../chipshop/public/application
however, works default route http://www.myhostname.com.
is there wrong in configuration or configuration rule has been changed? thanks
[update]
there similar post zf2 routing configuration, tried method:
'user' => array( 'type' => 'zend\mvc\router\http\literal', 'options' => array( 'route' => '/user', 'defaults' => array( 'controller' => 'application\controller\user', 'action' => 'some-action', ), ), ) ,
but still not work me..
solution
issue not in code side. in confiuration. 1, forgot enable apache rewrite module. said in akond post. 2, in virtualhost confiuration,
allowoverride none
should changed
allowoverride all
https://github.com/zendframework/zf2 states master branch contains 2.2.5dev. dev releases potentially unstable , should not rely on them. use composer
"require": { "zendframework/zendframework": "~2.2.0" }
and fine.
update
the error message says cannot find application directory. of course not exist, since virtual. means problem not in zf routes @ all. check
.htaccess
file exists inpublic
directory , of correct content- appache configured parse
.htaccess
file mod_rewrite
module on.- the directory
public
directory exist - and virtual host attached directory.
Comments
Post a Comment