41 lines
1.2 KiB
PHP
41 lines
1.2 KiB
PHP
<?php
|
|
namespace Makai;
|
|
|
|
use Index\Autoloader;
|
|
use Index\Data\ConnectionFailedException;
|
|
use Index\Data\MariaDB\MariaDBBackend;
|
|
use Index\Data\MariaDB\MariaDBConnectionInfo;
|
|
|
|
define('MKI_STARTUP', microtime(true));
|
|
define('MKI_ROOT', __DIR__);
|
|
define('MKI_DEBUG', is_file(MKI_ROOT . '/.debug'));
|
|
define('MKI_DIR_SRC', MKI_ROOT . '/src');
|
|
define('MKI_DIR_LIB', MKI_ROOT . '/lib');
|
|
define('MKI_DIR_PUB', MKI_ROOT . '/public');
|
|
define('MKI_DIR_PAGES', MKI_ROOT . '/pages');
|
|
|
|
if(MKI_DEBUG) {
|
|
ini_set('display_errors', 'on');
|
|
error_reporting(-1);
|
|
} else {
|
|
ini_set('display_errors', 'off');
|
|
error_reporting(0);
|
|
}
|
|
|
|
require_once MKI_DIR_LIB . '/index/index.php';
|
|
|
|
Autoloader::addNamespace(__NAMESPACE__, MKI_DIR_SRC);
|
|
|
|
try {
|
|
$db = (new MariaDBBackend)->createConnection(MariaDBConnectionInfo::create(
|
|
'unix:/var/run/mysqld/mysqld.sock',
|
|
'website',
|
|
'A3NjVvHRkHAxiYgk8MM4ZrCwrLVyPIYX',
|
|
'website',
|
|
'utf8mb4',
|
|
'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\'',
|
|
));
|
|
} catch(ConnectionFailedException $ex) {
|
|
echo '<h3>Unable to connect to database</h3>';
|
|
die($ex->getMessage());
|
|
}
|