0
votes

I searched a lot but didn't get any solution. I am getting following error and stuck after that.

Fatal error: Uncaught exception 'Zend_Application_Bootstrap_Exception' with message 'Resource matching "db" not found' in /var/www/html/ZendTecAdmin/library/Zend/Application/Bootstrap/BootstrapAbstract.php:694 Stack trace: #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 on line 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

public/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\'');
}
}

Please help me to resolve this. Any support will be appreciable.

1
You only define a db resource in the development section of your config. Is your environment variable set to development?Mike B
Where to set can you explain me with more detail.user3165155
Move the resource.db.* parts in your config under [development] up to [production]Mike B
I got the solution now its working fine, thank you for your help.user3165155
@Mike B : I modified application.ini as per your suggestion now its working fine.user3165155

1 Answers

0
votes

I used this in my project

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

See https://code.google.com/p/bhaa/source/browse/trunk/application/Bootstrap.php