From 548e207a37904c37685f395ff1c0b69fa06767c1 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Fri, 16 Dec 2016 10:48:55 -0700 Subject: [PATCH] Reworked PHP CLI router PR #1218 --- index.php | 6 ++++++ system/router.php | 26 ++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 system/router.php diff --git a/index.php b/index.php index 77725b92a2..8d8d2b62f7 100644 --- a/index.php +++ b/index.php @@ -14,6 +14,12 @@ die("Please run: bin/grav install"); } +if (PHP_SAPI == 'cli-server') { + if (!isset($_SERVER['PHP_CLI_ROUTER'])) { + die("PHP webserver requires a router to run Grav, please use:
php -S {$_SERVER["SERVER_NAME"]}:{$_SERVER["SERVER_PORT"]} system/router.php
"); + } +} + use Grav\Common\Grav; use RocketTheme\Toolbox\Event\Event; diff --git a/system/router.php b/system/router.php new file mode 100644 index 0000000000..53e0126cf6 --- /dev/null +++ b/system/router.php @@ -0,0 +1,26 @@ +