开发者

Route error after transfer zend projects from Windows to Linux

When i transfer my zend framework application from windows(zf 1.10.3) to开发者_JAVA技巧 linux (zf.10.7) some controllers work fine but some show this exception

Fatal error: Undefined class constant 'EXCEPTION_NO_ROUTE' in /path/to/application/modules/default/controllers/ErrorController.php on line 11

/controllers

VideoController.php

/view

/scripts

/Video

index.phtml

VideoController.php

class VideoController extend Zend_Controller_Action
{
  public indexAction(){}
}

Weacan that did not correctly ?


Solved just comment in default error controller case:NO_ROUTE


I had to add to the file Zend/Controller/Plugin/ErrorHandler.php

Around line 50, the other exception types are defined. I added the following to the file:

 /**
 * Const - No Route Exception; cannot find route to target
 */
const EXCEPTION_NO_ROUTE = 'EXCEPTION_NO_ROUTE';

Not sure why this is used in the Framework, but not defined...


I had exactly this problem, and it was cause by having two zend-framework installations on my machine. Zend-frameworks comes with basically two parts:

  • a set of php-files, which you can use, call, extend from, etc etc in your Zend application.
  • a set of commands, mainly zf.sh/zf/zf.php/zf.bat .

If you use the zf-command from a different version/installation/... of zend than the classes that are available via include_path in your php-configuration, you risk that the files the zf command creates are incompatible. Incompatible meaning they assume a certain set of classes with a certain blueprint. This assumption is of course easily broken in this case.

To fix this, locate where your zf-command is installed, on linux/osx:

justin:~ herbert$ which zf
/usr/share/zend-framework/bin//zf
justin:~ herbert$ 

on windows: use windows explorer, and search (feel free to comment a better way, I am a windows-noknowhow)

BE VERY THOROUGH IN YOUR SEARCH!!! Maybe 'which' tells you your executable is in '/usr/bin/zf', but this might be a symbolic link. Follow it and find the real location.

So in my case it is located in /usr/share/zend-framework/bin/, then the Zend-installation of zf is located in /usr/share/zend-framework/ (probably, I have no idea if distro's like ubuntu mess with this).

Anyhow, the php-files your project uses are in /usr/share/zend-framework/library/ (so the library subdirectory). Tell your php this by editing your php.ini (/etc/ ... /php.ini):

include_path = "/usr/share/zend-framework/library/"

Finaly restart your apache

apachectl restart

NOTE:

how to find multiple installations of the Zend framework:

justin:~ herbert$ updatedb  (or on osx:  /usr/libexec/locate.updatedb)
justin:~ herbert$ locate Zend/Application.php

Any of the directories with Zend/Application.ini 'could' be Zend frameworks ;)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜