Skip to content

Commit 066285a

Browse files
committed
Add router script for PHP built-in server
1 parent 5f0775f commit 066285a

2 files changed

Lines changed: 18 additions & 3 deletions

File tree

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,17 @@ codeigniter/
3535
$ composer create-project kenjis/codeigniter-composer-installer codeigniter
3636
```
3737

38-
If you want to install translations for system messages (requires shell).
38+
If you want to install translations for system messages (requires shell):
3939

4040
```
4141
$ bin/install-translations.sh
4242
```
4343

44-
### Run PHP built-in server
44+
### Run PHP built-in server (PHP 5.4 or later)
4545

4646
```
4747
$ cd /path/to/codeigniter
48-
$ php -S localhost:8000 -t public/
48+
$ php -S localhost:8000 -t public/ bin/router.php
4949
```
5050

5151
### Update CodeIgniter

bin/router.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
$file = $_SERVER['DOCUMENT_ROOT'] . $_SERVER['SCRIPT_NAME'];
4+
//echo $file, PHP_EOL;
5+
6+
if (is_file($file)) {
7+
return false;
8+
}
9+
10+
//$_SERVER = array_merge($_SERVER, $_ENV);
11+
12+
$_SERVER['SCRIPT_FILENAME'] = $_SERVER['DOCUMENT_ROOT'] . '/' . 'index.php';
13+
//echo $_SERVER['SCRIPT_FILENAME'], PHP_EOL;
14+
15+
require './index.php';

0 commit comments

Comments
 (0)