support php internal webserver

This commit is contained in:
MaZderMind 2016-06-20 22:41:47 +02:00
parent 37554e5112
commit 9b8e234c6c
4 changed files with 35 additions and 2 deletions

View file

@ -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]

View file

@ -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

View file

@ -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

2
serve.sh Executable file
View file

@ -0,0 +1,2 @@
#!/bin/sh
php -S localhost:8000 -d short_open_tag=true index.php