Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 9e5af8e

Browse files
some changes
and increase scripts timeout for testing on low spec pc's
1 parent 5badd34 commit 9e5af8e

File tree

2 files changed

+30
-25
lines changed

2 files changed

+30
-25
lines changed

‎package.json‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
"description": "A router library for your PHP Built-in Webserver.",
55
"main": "index.js",
66
"scripts": {
7-
"start-default": "php -S 0.0.0.0:9000 src/router.php",
8-
"start-codeigniter": "php -S 0.0.0.0:9001 -t ./codeigniter src/router.php",
9-
"start-yii": "php -S 0.0.0.0:9002 -t ./yii/web src/router.php",
10-
"start-wordpress": "php -S 0.0.0.0:9003 -t ./wordpress src/router.php",
11-
"start-wordpress48": "php -S 0.0.0.0:9004 -t ./wordpress48 src/router.php",
12-
"start-drupal7": "php -S 0.0.0.0:9005 -t ./drupal7 src/router.php",
7+
"start-default": "php -d max_execution_time=280 -S 0.0.0.0:9000 src/router.php",
8+
"start-codeigniter": "php -d max_execution_time=280 -S 0.0.0.0:9001 -t ./codeigniter src/router.php",
9+
"start-yii": "php -d max_execution_time=280 -S 0.0.0.0:9002 -t ./yii/web src/router.php",
10+
"start-wordpress": "php -d max_execution_time=280 -S 0.0.0.0:9003 -t ./wordpress src/router.php",
11+
"start-wordpress48": "php -d max_execution_time=280 -S 0.0.0.0:9004 -t ./wordpress48 src/router.php",
12+
"start-drupal7": "php -d max_execution_time=280 -S 0.0.0.0:9005 -t ./drupal7 src/router.php",
1313
"start-drupal8": "php -d max_execution_time=280 -S 0.0.0.0:9006 -t ./drupal8 src/router.php",
1414
"test-router-path": "node ./test/routerPath.js"
1515
},

‎src/router.class.php‎

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ class PHP_Webserver_Router
4747
var $php_warning = 0;
4848
var $php_notice = 0;
4949

50+
var $script_filename = "";
51+
5052
function __construct()
5153
{
5254

@@ -80,6 +82,7 @@ private function init()
8082
}
8183

8284
$this->refresh_paths();
85+
$this->script_filename = $_SERVER['SCRIPT_FILENAME'];
8386

8487
$this->request_uri = \filter_input(\INPUT_SERVER, 'REQUEST_URI', \FILTER_SANITIZE_ENCODED);
8588
$this->request_uri = $this->format_unix(urldecode($this->request_uri));
@@ -401,9 +404,26 @@ function console_output()
401404

402405
$this->favicon();
403406

404-
//header("Content-Length: 0");
405-
//return false;
406-
return include($_SERVER['DOCUMENT_ROOT'] . "/$this->indexPath");
407+
//echo $this->script_filename.'<br />'.$_SERVER['SCRIPT_FILENAME'];
408+
//die();
409+
410+
if( in_array($this->getExt($this->script_filename), array("","php")) ){
411+
412+
//return include($_SERVER['SCRIPT_FILENAME']);
413+
return include($_SERVER['DOCUMENT_ROOT'] .'/' . $this->indexPath);
414+
415+
}else{
416+
417+
return include($this->script_filename);
418+
419+
}
420+
421+
//$_SERVER['PHP_SELF'] = rtrim($this->format_unix($_SERVER['PHP_SELF']),'/') ;
422+
//$_SERVER['PATH_INFO'] = $this->format_unix($uri_path);
423+
424+
//echo '<pre>';
425+
//print_r($_SERVER);
426+
407427

408428
}
409429

@@ -484,22 +504,7 @@ function listen()
484504

485505
if ($this->URIhasPHP()) {
486506

487-
if ($this->mvc_enabled == TRUE) {
488-
489-
return FALSE;
490-
491-
} else {
492-
493-
/**
494-
* Fix for 404 errors
495-
*/
496-
header("Content-Length: -1");
497-
498-
$this->indexPath = $this->URI_Filename() !== FALSE ? $this->URI_Filename() : $this->URI_no_query();
499-
500-
return $this->bootstrap();
501-
502-
}
507+
return FALSE;
503508

504509
}
505510

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /