Jump to content

php config.ini & index.php(bootstrap)


koushika

Recommended Posts

 

Fatal error: Uncaught exception 'Zend_Db_Adapter_Exception' with message 'Configuration array must have a key for 'dbname' that names the database instance' in C:\wamp\www\Theater\library\Zend\Db\Adapter\Abstract.php:242 Stack trace: #0 C:\wamp\www\Theater\library\Zend\Db\Adapter\Abstract.php(173): Zend_Db_Adapter_Abstract->_checkRequiredOptions(Array) #1 C:\wamp\www\Theater\library\Zend\Db.php(247): Zend_Db_Adapter_Abstract->__construct(Array) #2 C:\wamp\www\Theater\public\index.php(67): Zend_Db::factory(Object(Zend_Config)) #3 {main} thrown in C:\wamp\www\Theater\library\Zend\Db\Adapter\Abstract.php on line 242

 

<?

 

// For our dev environment we will report all errors to the screen   

error_reporting(E_ALL | E_STRICT);   

ini_set('display_startup_errors', 1);   

ini_set('display_errors', 1);

 

//timezone

date_default_timezone_set('Europe/London');

 

 

// directory setup and class loading

set_include_path('.' . PATH_SEPARATOR . '../library/'

    . PATH_SEPARATOR . '../application/models'

    . PATH_SEPARATOR . get_include_path());

 

 

/**

* Zend Loader

*/

require_once "Zend/Loader.php";

Zend_Loader::registerAutoload();

 

/**

* Required classes

*/

Zend_Loader::loadClass('Zend_Controller_Front');

Zend_Loader::loadClass('Zend_Config_Ini');

Zend_Loader::loadClass('Zend_View');

Zend_Loader::loadClass('Zend_Session');

Zend_Loader::loadClass('Zend_Log');

Zend_Loader::loadClass('Zend_Controller_Request_Http');

Zend_Loader::loadClass('Zend_Debug');

Zend_Loader::loadClass('Zend_Auth');

Zend_Loader::loadClass('Zend_Db');

Zend_Loader::loadClass('Zend_Db_Table');

Zend_Loader::loadClass('Zend_Registry');

 

 

// load configuration

$config = new Zend_Config_Ini('../application/config.ini','localhost');

$registry = Zend_Registry::getInstance();

$registry->set('config', $config);

 

// setup database

$db = Zend_Db::factory($config->db);

Zend_Db_Table::setDefaultAdapter($db);

 

 

// setup controller

$frontController = Zend_Controller_Front::getInstance();

$frontController->throwExceptions(true);

$frontController->setControllerDirectory('../application/controllers');

//Zend_Layout::startMvc(array('layoutPath'=>'../application/layouts'));

 

 

// run!

$frontController->dispatch();

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.