2012-01-10 7 views
2

フロントエンドモジュールとバックエンドモジュールを使用してモジュール式Zend Frameworkプロジェクトをセットアップしようとしていますが、機能しません。私は、Webブラウザで私のpublicディレクトリにアクセスすると、私は、このエラーメッセージが表示されます:モジュール式Zend Frameworkプロジェクトを開始する際に問題が発生しました

Fatal error: Uncaught exception 'Zend_Controller_Dispatcher_Exception' with message 'Invalid controller specified (error)' in /usr/share/ZendFrameworkCli/library/Zend/Controller/Dispatcher/Standard.php:248 Stack trace: #0 /usr/share/ZendFrameworkCli/library/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) #1 /usr/share/ZendFrameworkCli/library/Zend/Application/Bootstrap/Bootstrap.php(97): Zend_Controller_Front->dispatch() #2 /usr/share/ZendFrameworkCli/library/Zend/Application.php(366): Zend_Application_Bootstrap_Bootstrap->run() #3 /Users/Martin/Dropbox/Repositories/realestatecms/public/index.php(25): Zend_Application->run() #4 {main} Next exception 'Zend_Controller_Exception' with message 'Invalid controller specified (error)#0 /usr/share/ZendFrameworkCli/library/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) in /usr/share/ZendFrameworkCli/library/Zend/Controller/Plugin/Broker.php on line 336

私はZend Frameworkのコマンドラインツールを使用して2つのモジュールを作成して、それらの2つのmoduleのディレクトリと呼ばれるにBootstrap.php 2を持つクラスを持っていますそれぞれFrontend_BootstrapおよびBackend_Bootstrapである。

マイapplication.iniファイルは次のようになります。

[production] 
phpSettings.display_startup_errors = 0 
phpSettings.display_errors = 0 
includePaths.library = APPLICATION_PATH "/../library" 
bootstrap.path = APPLICATION_PATH "/Bootstrap.php" 
bootstrap.class = "Bootstrap" 
appnamespace = "Application" 
resources.frontController.controllerDirectory = APPLICATION_PATH "/frontend/controllers" 
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules" 
resources.frontController.params.displayExceptions = 0 
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/" 
... 

は私が間違って何をしましたか?ブラウザでhttp://example.com/publicにアクセスしたときにFrontend_IndexController()を実行させるにはどうすればよいですか?

EDIT:私はイワンの答えどおりのラインで自分の設定ファイルを更新した場合、私は今、このエラーメッセージが出ます:それは、クラス名などからDefault_Bootstrapを取得している

Fatal error: Uncaught exception 'Zend_Application_Resource_Exception' with message 'Bootstrap file found for module "default" but bootstrap class "Default_Bootstrap" not found' in /usr/share/ZendFrameworkCli/library/Zend/Application/Resource/Modules.php:83 Stack trace: #0 /usr/share/ZendFrameworkCli/library/Zend/Application/Bootstrap/BootstrapAbstract.php(683): Zend_Application_Resource_Modules->init() #1 /usr/share/ZendFrameworkCli/library/Zend/Application/Bootstrap/BootstrapAbstract.php(626): Zend_Application_Bootstrap_BootstrapAbstract->_executeResource('modules')

2 /usr/share/ZendFrameworkCli/library/Zend/Application/Bootstrap/BootstrapAbstract.php(586):

Zend_Application_Bootstrap_BootstrapAbstract->_bootstrap(NULL) #3 /usr/share/ZendFrameworkCli/library/Zend/Application.php(355): Zend_Application_Bootstrap_BootstrapAbstract->bootstrap(NULL) #4 /Users/Martin/Dropbox/Repositories/realestatecms/public/index.php(25): Zend_Application->bootstrap() #5 {main} thrown in /usr/share/ZendFrameworkCli/library/Zend/Application/Resource/Modules.php on line 83

を!

+0

in /modules/default/Bootstrap.phpブートストラップクラス名を確認してください。モジュールブートストラップのロジックは 'Zend_Application_Resource_Modules :: init()'にあります。 – Xerkus

答えて

1

私は同じ問題を抱えていたし、私はこのページで解決策を見つけた: http://updel.com/zend-framework-modular-application/

あなたは/MyApp/application/configs/application.iniに次の行をコメントアウトする必要があります。

resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers" 

このように:それは問題を修正し

;resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers" 

、残念ながら私は申し訳ありませんが、理由を理解/説明するのに十分習熟していませんよ。 :-)

私はそれが助けてくれることを願っています。

0

あなたは、この行を変更しました:インデックス/インデックスはこれらの設定オプションを使用するよりも、あなたは他のデフォルトモジュール/コントローラが必要な場合は、次に

resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers" 

resources.frontController.controllerDirectory = APPLICATION_PATH "/frontend/controllers" 

を私はそれがこのようにすべきだと思います。

resources.frontController.defaultControllerName = "index" 
resources.frontController.defaultAction = "index" 
resources.frontController.defaultModule = "frontend" 

http://yoursite.com/publicにアクセスする必要があります。エラーが発生します。公開ディレクトリには、WebのDocumentRootである必要があり、あなたはこのようにそれにアクセスします。あなたが呼び出すとき、http://yoursite.com/

+0

こんにちはIvan。答える時間をとってくれてありがとう。元の投稿を更新しました。新しいエラーメッセージが表示されています。 –

+0

私は決してデフォルト値を変更しませんでした。私はそのような仕事のためのルートを好む。 – Xerkus

+0

モジュールディレクトリ内に、フロントエンド、バックエンド、およびデフォルトディレクトリ、およびデフォルトモジュールの適切なブートストラップクラスのモジュールがすべて含まれていることを確認してください。 "Default_Bootstrap" – kingdaemon

0

マーティンhttp://example.com/public Zend Frameworkのルータが探しているので、あなたが見たエラーがスローされますコントローラ公開と命名されました。
Zend FrameのWebサイトを表示する通常の方法は、http://example.comまたはhttp://example.com/index.phpに電話することです。
アプリケーションへのすべてのリクエストは/application/public/index.phpにルーティングされます。

のためのあなたの元の構成のように見えます:

resources.frontController.controllerDirectory = APPLICATION_PATH "/frontend/controllers" 

、アプリケーションの可能性が正しかったです。

これらは、構造に応じて、いくつかの違いがある場合がモジュールに

resources.frontController.moduleDirectory = APPLICATION_PATH "/modules" 
resources.frontController.moduleControllerDirectoryName = "controllers" 
resources.frontController.params.prefixDefaultModule = ""//Frontend may be your default 
resources.modules = "" 

を有効にするためののapplication.iniにおける典型的なラインです。
はまた、通常、それはあなたのディレクトリ構造やアプリケーションを含めてください、これはあなたの問題を解決する助けにはならない場合* Zend_Application_Module_Bootstrap *

class Admin_Bootstrap extends Zend_Application_Module_Bootstrap { 
    //put your code here 
} 

を拡張して独自のbootstrap.phpのだ含めて、各モジュールのディレクトリのために有用です。 ini(あなたはdb設定などを省略することができます)、Index.phpはデフォルトから変更されていると便利です。
また、ご使用のZend Frameworkのバージョンも含めてください。

関連する問題