dongwei2983 2013-06-26 07:12
浏览 65

PHP zend框架不会加载模块

Hi everyone i'm trying to create a rest service using the zend framework I have basicly copied the actual app that this rest service is going to be for. i removed the layout folder and the view folders.

My problem is the modules don't seem to be loading at all and i get the following output when i go to the index.php

problemInvalid controller specified (error)#0 /home/********/*****/library/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) #1 /home/********/*****/library/Zend/Application/Bootstrap/Bootstrap.php(97): Zend_Controller_Front->dispatch() #2 /home/********/*****/library/Zend/Application.php(366): Zend_Application_Bootstrap_Bootstrap->run() #3 /home/********/public_html/portal/websvc/index.php(34): Zend_Application->run() #4 {main}

I'm not sure why this isnt working. its basicly the same settings as my original app that has 20 modules and there is no problem with that.

PLEASE HELP! :'(

so i basicly have the following folder structure

/app/modules
/app/modules/v1
/app/modules/v1/controllers
/app/modules/v1/controllers/OutboundController.php
/app/modules/v1/controllers/ProductController.php
/app/modules/v1/Bootstrap.php
/app/modules/default
/app/modules/default/controllers
/app/modules/default/controllers/errorController.php
/app/config/

This is my application.ini

[production]
includePaths.library = APPLICATION_PATH "/../../../library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
appnamespace = "Application"
resources.frontController.defaultModule = "v1"
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
resources.frontController.moduleControllerDirectoryName = "controllers"

resources.router.routes.rest.type = Zend_Rest_Route

My bootstrap.php

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap {

protected function _initautoloader()    {
    $autoloader = new Zend_Application_Module_Autoloader(array(
        'basePath'  => APPLICATION_PATH."/modules/default",
        'namespace' => '',
    ));

    $resourceAutoLoader = new Zend_Loader_Autoloader_Resource(array(
        'basePath'  => APPLICATION_PATH,
        'namespace' => '',
    ));
    $resourceAutoLoader->addResourceTypes(array(
            "class" => array(
                            'namespace' => 'Class',
                            'path'      => '/../../../library/Class'
                        ),
            "model" => array(
                            'namespace' => 'Model',
                            'path' => '/../../../library/Models'
                        )
    ));   
}




protected function _initFrontModules() 
{ 
    $this->bootstrap('frontController'); 
    $front = $this->getResource('frontController'); 
    $front->addModuleDirectory(APPLICATION_PATH . '/modules');
}

}

My index.php

// Define path to application directory
defined('APPLICATION_PATH')
    || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../../../ibwms/applications/external/websvc'));

// Define application environment
defined('APPLICATION_ENV')
    || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'development'));


// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
    realpath(APPLICATION_PATH . '/../../../library'),
    get_include_path(),
)));

/* Zend_Application */
require_once 'Zend/Application.php';
// Create application, bootstrap, and run
try{


$application = new Zend_Application(
    APPLICATION_ENV,
    APPLICATION_PATH . '/configs/application.ini'
);

Zend_Controller_Front::getInstance()->setBaseUrl('/portal/websvc/');

$application->bootstrap()
            ->run();

}catch(Exception $e)
{
    echo 'problem'.$e->getMessage();
}
  • 写回答

1条回答 默认 最新

  • douna3367 2013-06-26 09:16
    关注

    Rename

    /app/modules/default/controllers/errorController.php
    

    to

    /app/modules/default/controllers/ErrorController.php
    

    Most likely there's an exception and application is trying to display it, but is unable to load the ErrorController

    评论

报告相同问题?

悬赏问题

  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?