ZEND FRAMEWORK致命错误:未捕获的异常'Zend_Application_Bootstrap_Exception'

时间:2014-01-06 12:50:09

标签: php mysql zend-framework

我搜索了很多,但没有得到任何解决方案。我得到了跟随错误并在此之后陷入困境。

  

致命错误:未捕获的异常'Zend_Application_Bootstrap_Exception'   消息“资源匹配”db“未找到”   /var/www/html/ZendTecAdmin/library/Zend/Application/Bootstrap/BootstrapAbstract.php:694   堆栈跟踪:#0   /var/www/html/ZendTecAdmin/library/Zend/Application/Bootstrap/BootstrapAbstract.php(629):   Zend_Application_Bootstrap_BootstrapAbstract-> _executeResource( 'DB')

     

1 /var/www/html/ZendTecAdmin/library/Zend/Application/Bootstrap/BootstrapAbstract.php(586):

     

Zend_Application_Bootstrap_BootstrapAbstract-> _bootstrap('db')#2   /var/www/html/ZendTecAdmin/application/Bootstrap.php(6):   Zend_Application_Bootstrap_BootstrapAbstract-> bootstrap('db')#3   /var/www/html/ZendTecAdmin/library/Zend/Application/Bootstrap/BootstrapAbstract.php(669):   Bootstrap-> _initMyDb()#4   /var/www/html/ZendTecAdmin/library/Zend/Application/Bootstrap/BootstrapAbstract.php(622):   Zend_Application_Bootstrap_BootstrapAbstract-> _executeResource( 'MYDB')

     

5 /var/www/html/ZendTecAdmin/library/Zend/Application/Bootstrap/BootstrapAbstract.php(586):

     

Z in   /var/www/html/ZendTecAdmin/library/Zend/Application/Bootstrap/BootstrapAbstract.php   在第694行

Apllication.ini

[production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
includePaths.library = APPLICATION_PATH "/../library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
appnamespace = "Application"
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.frontController.params.displayExceptions = 1

resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"

resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"
resources.frontController.baseUrl = "/ZendTecAdmin/"
urces.db.isDefaultTableAdapter = true

resources.db.params.profiler.enabled = true
resources.session.remember_me_seconds = 864000

[staging : production]

[testing : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1

[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1

resources.db.adapter = "PDO_MYSQL"
resources.db.parurces.db.isDefaultTableAdapter = true

resources.db.params.profiler.enabled = trueams.host = "localhost"
resources.db.params.username = "root"
resources.db.params.password = "root123"
resources.db.params.dbname = "appointment_db"
resources.db.isDefaultTableAdapter = true

resources.db.params.profiler.enabled = true
resources.db.params.profiler.class = Zend_Db_Profiler_Firebug

公共/ index.php的

<?php
// Define path to application directory
defined('APPLICATION_PATH')
    || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));

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

// 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


$application = new Zend_Application(
    APPLICATION_ENV,
    APPLICATION_PATH . '/configs/application.ini'
);
$application->bootstrap()
            ->run();
Zend_Db_Table::getDefaultAdapter();
    //define('BASE_URL', $baseUrl);

bootstrap.php中

<?php

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{    
    protected function _initMyDb() {
    $this->bootstrap('db');
    $resource = $this->getPluginResource('db');
    $db = $resource->getDbAdapter();
    $db->query('SET CHARACTER SET \'UTF8\'');
}
}

请帮我解决这个问题。 任何支持都会很明显。

1 个答案:

答案 0 :(得分:0)

我在我的项目中使用了这个

protected function _initRegistry()
{
    $this->bootstrap('db');
    $db = $this->getResource('db');
    $db->query("SET NAMES 'utf8'");
}

请参阅https://code.google.com/p/bhaa/source/browse/trunk/application/Bootstrap.php