1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <?php
- namespace Grav;
- \define('GRAV_REQUEST_TIME', microtime(true));
- \define('GRAV_PHP_MIN', '7.3.6');
- if (version_compare($ver = PHP_VERSION, $req = GRAV_PHP_MIN, '<')) {
- die(sprintf('You are running PHP %s, but Grav needs at least <strong>PHP %s</strong> to run.', $ver, $req));
- }
- if (PHP_SAPI === 'cli-server') {
- $symfony_server = stripos(getenv('_'), 'symfony') !== false || stripos($_SERVER['SERVER_SOFTWARE'], 'symfony
- ') !== false;
- if (!isset($_SERVER['PHP_CLI_ROUTER']) && !$symfony_server) {
- die("PHP webserver requires a router to run Grav, please use: <pre>php -S {$_SERVER['SERVER_NAME']}:{$_SERVER['SERVER_PORT']} system/router.php</pre>");
- }
- }
- date_default_timezone_set(@date_default_timezone_get());
- if (!\extension_loaded('mbstring')) {
- die("'mbstring' extension is not loaded. This is required for Grav to run correctly");
- }
- @ini_set('default_charset', 'UTF-8');
- mb_internal_encoding('UTF-8');
- $autoload = __DIR__ . '/vendor/autoload.php';
- if (!is_file($autoload)) {
- die('Please run: <i>bin/grav install</i>');
- }
- $loader = require $autoload;
- use Grav\Common\Grav;
- use RocketTheme\Toolbox\Event\Event;
- $grav = Grav::instance(
- array(
- 'loader' => $loader
- )
- );
- try {
- $grav->process();
- } catch (\Error $e) {
- $grav->fireEvent('onFatalException', new Event(array('exception' => $e)));
- throw $e;
- } catch (\Exception $e) {
- $grav->fireEvent('onFatalException', new Event(array('exception' => $e)));
- throw $e;
- }
|