| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 
 |  
<?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') : 'production'));
 
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
    realpath(APPLICATION_PATH . '/../library'),
    realpath(APPLICATION_PATH . '/models'),
    realpath(APPLICATION_PATH . '/forms'),
 
    get_include_path()
)));
 
/** Zend_Application */
require_once 'Zend/View.php';  
 
$view = new Zend_View();
$view->setHelperPath(realpath(APPLICATION_PATH . '/views/helpers'));
 
 
 
/** Zend_Application */
require_once 'Zend/Application.php';  
 
// Create application, bootstrap, and run
$application = new Zend_Application(
    APPLICATION_ENV, 
    APPLICATION_PATH . '/configs/application.ini'
);
 
// Chargement automatique de Zend_Db_Adapter_Pdo_Mysql, et instanciation.
$config = new Zend_Config_Ini('./application/configs/application.ini', 'production');
 
$db = Zend_Db::factory($config->database->adapter,array(
	'host'  	=> $config->database->host, 
	'username'  => $config->database->params->username,
	'password'  => $config->database->params->password,
	'dbname'  	=> $config->database->params->dbname,
		)
);
 
$registry = Zend_Registry::getInstance();
 
// placons la connexion dans un registre global à l'application
 
$registry->set('db', $db);
// en faire la connexion par defaut
Zend_Db_Table::setDefaultAdapter($db);	
 
$application->bootstrap();
$application->run(); | 
Partager