33 lines
1 KiB
PHP
33 lines
1 KiB
PHP
<?php
|
|
namespace Mince;
|
|
|
|
use Index\Environment;
|
|
use Index\Data\ConnectionFailedException;
|
|
use Index\Data\DbTools;
|
|
|
|
define('MCR_STARTUP', microtime(true));
|
|
define('MCR_ROOT', __DIR__);
|
|
define('MCR_DEBUG', is_file(MCR_ROOT . '/.debug'));
|
|
define('MCR_DIR_SRC', MCR_ROOT . '/src');
|
|
define('MCR_DIR_PUB', MCR_ROOT . '/public');
|
|
define('MCR_DIR_PRV', MCR_ROOT . '/private');
|
|
define('MCR_DIR_CFG', MCR_ROOT . '/config');
|
|
define('MCR_DIR_MIG', MCR_ROOT . '/database');
|
|
define('MCR_DIR_TPL', MCR_ROOT . '/templates');
|
|
|
|
require_once MCR_ROOT . '/vendor/autoload.php';
|
|
|
|
Environment::setDebug(MCR_DEBUG);
|
|
|
|
$config = parse_ini_file(MCR_DIR_CFG . '/config.ini');
|
|
if($config === false)
|
|
die('Config sux.');
|
|
|
|
try {
|
|
$db = DbTools::create($config['dsn']);
|
|
} catch(ConnectionFailedException $ex) {
|
|
echo '<h3>Unable to connect to database</h3>';
|
|
die($ex->getMessage());
|
|
}
|
|
|
|
$db->execute('SET SESSION time_zone = "+00:00", sql_mode = "STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION"');
|