MonarcAppFO/public/index.php

40 lines
1.1 KiB
PHP

<?php
use Monarc\Core\Service\Initializer\ObjectManagerInitializer;
use Zend\Mvc\Application;
chdir(dirname(__DIR__));
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
// Decline static file requests back to the PHP built-in webserver
if (php_sapi_name() === 'cli-server') {
$path = realpath(__DIR__ . parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH));
if (__FILE__ !== $path && is_file($path)) {
return false;
}
unset($path);
}
if(date_default_timezone_get() != ini_get('date.timezone')){
date_default_timezone_set('Europe/Luxembourg');
}
include 'vendor/autoload.php';
if (! class_exists(Application::class)) {
throw new RuntimeException(
"Unable to load application.\n"
. "- Type `composer install` if you are developing locally.\n"
);
}
$appConfig = require 'config/application.config.php';
if (file_exists('config/development.config.php')) {
$appConfig = Zend\Stdlib\ArrayUtils::merge($appConfig, include 'config/development.config.php');
}
Application::init($appConfig)->run();