php - Fatal error: Uncaught exception 'Zend_Db_Table_Exception' -
i using zend1.12. placed index.php public root folder , changed configuration after throwing below error.
i getting following error , configuration looks fine.
fatal error: uncaught exception 'zend_db_table_exception' message 'no adapter found application_model_content' in /var/www/html/library/zend/db/table/abstract.php:756 stack trace: #0 /var/www/html/library/zend/db/table/abstract.php(740): zend_db_table_abstract->_setupdatabaseadapter() #1 /var/www/html/library/zend/db/table/abstract.php(269): zend_db_table_abstract->_setup() #2 /var/www/html/library/zend/db/table.php(77): zend_db_table_abstract->__construct(array) #3 /var/www/html/application/views/scripts/common/topnav.phtml(2): zend_db_table->__construct() #4 /var/www/html/library/zend/view.php(108): include('/var/www/html/a...') #5 /var/www/html/library/zend/view/abstract.php(888): zend_view->_run('/var/www/html/a...') #6 /var/www/html/application/layouts/scripts/front_header.phtml(29): zend_view_abstract->render('common/topnav.p...') #7 /var/www/html/library/zend/view.php(108): include('/var/www/html/a...') #8 /var/www/html/library/zend/view/abstract.php(888): zend_view->_run('/var/www/html/a...') #9 /var/www/ in /var/www/html/library/zend/controller/plugin/broker.php on line 336
below application/configs/applicatio.ini file
[production] phpsettings.display_startup_errors = 1 phpsettings.display_errors = 1 includepaths.library = base_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 = "/" resources.session.remember_me_seconds = 864000 [staging : production] [testing : production] phpsettings.display_startup_errors = 1 phpsettings.display_errors = 1 resources.db.adapter = "pdo_mysql" resources.db.params.host = "localhost" resources.db.params.username = "root" resources.db.params.password = "root123" resources.db.params.dbname = "labs" resources.db.isdefaulttableadapter = true [development : production] phpsettings.display_startup_errors = 1 phpsettings.display_errors = 1 resources.frontcontroller.params.displayexceptions = 1 resources.db.params.profiler.enabled = true resources.db.params.profiler.class = zend_db_profiler_firebug
/index.php
<?php date_default_timezone_set('indian/mahe'); // define path application directory define('base_path', realpath(dirname(__file__))); 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')); // include path set_include_path( base_path . '/library' /*. path_separator . '../zend' */ . path_separator . get_include_path() ); /** zend_application */ require_once 'zend/application.php'; // create application, bootstrap, , run $application = new zend_application( application_env, application_path . '/configs/application.ini' ); $application->bootstrap() ->run(); zend_db_table::getdefaultadapter();
/application/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\''); } protected function _initregistry() { $this->bootstrap('db'); $db = $this->getresource('db'); // $db->query("set names 'utf8'"); } }
you set adapter [testing: production]
.
[testing : production] ... resources.db.adapter = "pdo_mysql" resources.db.params.host = "localhost" resources.db.params.username = "root" resources.db.params.password = "root123" resources.db.params.dbname = "labs" resources.db.isdefaulttableadapter = true
have put in .htaccess
setenv application_env testing
.
or mistake , should deport in [production]
Comments
Post a Comment