Author Topic: help me regarding config.ini and index.php (bootstrap)  (Read 1389 times)

0 Members and 1 Guest are viewing this topic.

Offline koushikaTopic starter

  • Irregular
  • Posts: 2
    • View Profile
help me regarding config.ini and index.php (bootstrap)
« on: June 26, 2008, 01:20:44 PM »
<?php

# /**
# * Bootstrap file for zend framework
# *
# * Set the environment settings of zend framework
# *
# * PHP versions 5.2.6+
# *
# *
# * @category zend framework tutorials
# * @author koushika pk <pk.koushika@gmail.com>
# * @copyright koushika P K
# * @link http://framework.zend.com
# */ 


// 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();



config.ini

;database connection settings

[localhost] 

db.adapter   = PDO_MYSQL 
db.host      = localhost 
db.username  = koushika
db.password  = koushika
db.dbname    = guestbook 
show.errors  = true 
   
[production] 
db.adapter          = PDO_MYSQL 
db.config.host      = mysql_host_name 
db.config.username  = koushika
db.config.password  = koushika
show_errors         = false

Offline thorpe

  • Administrator
  • 'Mind Boggling!'
  • *
  • Posts: 29,256
    • View Profile
Re: help me regarding config.ini and index.php (bootstrap)
« Reply #1 on: June 26, 2008, 01:39:38 PM »
Do you have a question?