diff --git a/app/webroot/index.php b/app/webroot/index.php index 9ef8225db..6a4077c7f 100644 --- a/app/webroot/index.php +++ b/app/webroot/index.php @@ -24,6 +24,7 @@ if (!defined('DS')) { define('DS', DIRECTORY_SEPARATOR); } + /** * These defines should only be edited if you have cake installed in * a directory layout other than the way it is distributed. @@ -72,6 +73,9 @@ if (!defined('WWW_ROOT')) { // for built-in server if (php_sapi_name() == 'cli-server') { + if ($_SERVER['REQUEST_URI'] !== '/' && file_exists(WWW_ROOT . $_SERVER['REQUEST_URI'])) { + return false; + } $_SERVER['PHP_SELF'] = '/' . basename(__FILE__); } @@ -93,5 +97,6 @@ if (!empty($failed)) { App::uses('Dispatcher', 'Routing'); + $Dispatcher = new Dispatcher(); $Dispatcher->dispatch(new CakeRequest(), new CakeResponse()); diff --git a/lib/Cake/Console/Command/ServerShell.php b/lib/Cake/Console/Command/ServerShell.php index ce9272929..d4f9a929e 100644 --- a/lib/Cake/Console/Command/ServerShell.php +++ b/lib/Cake/Console/Command/ServerShell.php @@ -125,10 +125,11 @@ class ServerShell extends AppShell { return; } - $command = sprintf("php -S %s:%d -t %s", + $command = sprintf("php -S %s:%d -t %s %s", $this->_host, $this->_port, - $this->_documentRoot + $this->_documentRoot, + WEBROOT_DIR . '/index.php' ); $port = ($this->_port == self::DEFAULT_PORT) ? '' : ':' . $this->_port; diff --git a/lib/Cake/Console/Templates/skel/webroot/index.php b/lib/Cake/Console/Templates/skel/webroot/index.php index 38be5c4cd..d4ba7734a 100644 --- a/lib/Cake/Console/Templates/skel/webroot/index.php +++ b/lib/Cake/Console/Templates/skel/webroot/index.php @@ -74,6 +74,9 @@ if (!defined('WWW_ROOT')) { // for built-in server if (php_sapi_name() == 'cli-server') { + if ($_SERVER['REQUEST_URI'] !== '/' && file_exists(WWW_ROOT . $_SERVER['REQUEST_URI'])) { + return false; + } $_SERVER['PHP_SELF'] = '/' . basename(__FILE__); }