diff options
author | MaZderMind | 2016-06-20 22:41:47 +0200 |
---|---|---|
committer | MaZderMind | 2016-06-20 22:41:47 +0200 |
commit | 9b8e234c6c9ae545df3788c0603a5dd97ffc62b4 (patch) | |
tree | 448c21748ff9a9db0a2e71b04f1e1355c5447b09 | |
parent | 37554e5112397ee0f3565e3bcece2f4149ccd3df (diff) |
support php internal webserver
-rw-r--r-- | .htaccess | 2 | ||||
-rw-r--r-- | README.md | 15 | ||||
-rw-r--r-- | index.php | 18 | ||||
-rwxr-xr-x | serve.sh | 2 |
4 files changed, 35 insertions, 2 deletions
@@ -5,4 +5,4 @@ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-l -RewriteRule (.*) index.php?route=$1 [L] +RewriteRule (.*) index.php?route=$1&htaccess=1 [L] @@ -9,6 +9,21 @@ zu haben, die mit wenigen Konfigurationsoptionen und ein paar CSS-Rules an die Gegebenheiten und die Gestaltung der Konferenz angepasst werden können. +## Development + +Während der Entwicklung kann der eingebaute PHP-Webserver verwendet werden: +``` +$ ./serve.sh +PHP 7.0.4-7ubuntu2.1 Development Server started at Mon Jun 20 22:40:17 2016 +Listening on http://localhost:8000 +Document root is /home/peter/VOC/streaming-website +Press Ctrl-C to quit. +… +``` + +Unterstützt wird PHP ab 5.4. + + ## Setup @@ -28,7 +28,23 @@ require_once('model/Upcoming.php'); ob_start(); try { - $route = @$_GET['route']; + if(isset($_GET['htaccess'])) + { + $route = @$_GET['route']; + } + elseif(isset($_SERVER["REQUEST_URI"])) + { + $route = ltrim(@$_SERVER["REQUEST_URI"], '/'); + + // serve static + if($route != '' && file_exists($_SERVER["DOCUMENT_ROOT"].'/'.$route)) + { + return false; + } + + } + else $route = ''; + $route = rtrim($route, '/'); // generic template diff --git a/serve.sh b/serve.sh new file mode 100755 index 0000000..88881f4 --- /dev/null +++ b/serve.sh @@ -0,0 +1,2 @@ +#!/bin/sh +php -S localhost:8000 -d short_open_tag=true index.php |