Added support for both server vars
This commit is contained in:
parent
c69ea79785
commit
ec99235500
9
app.sh
Normal file → Executable file
9
app.sh
Normal file → Executable file
@ -14,4 +14,11 @@ fi
|
|||||||
# Handle multiple simultaneous requests in Linux only:
|
# Handle multiple simultaneous requests in Linux only:
|
||||||
export PHP_CLI_SERVER_WORKERS=4
|
export PHP_CLI_SERVER_WORKERS=4
|
||||||
|
|
||||||
php -S 0.0.0.0:$PORT index.php --enable-mbstring
|
FILTER=".*"
|
||||||
|
|
||||||
|
if [[ "$@" =~ "--quiet" ]]
|
||||||
|
then
|
||||||
|
FILTER="INFO"
|
||||||
|
fi
|
||||||
|
|
||||||
|
php -S 0.0.0.0:$PORT index.php --enable-mbstring 2>&1 | grep -E "${FILTER}"
|
||||||
|
@ -14,6 +14,19 @@
|
|||||||
// PHP 5.3.9:
|
// PHP 5.3.9:
|
||||||
if ($strParam == null)
|
if ($strParam == null)
|
||||||
$strParam = "";
|
$strParam = "";
|
||||||
|
|
||||||
|
error_log("INFO: " . json_encode($_SERVER, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
|
||||||
|
|
||||||
|
foreach (["REQUEST_URI", "PATH_INFO"] as $k)
|
||||||
|
if (strlen($strParam) < 1)
|
||||||
|
{
|
||||||
|
if (is_array($_SERVER))
|
||||||
|
if (array_key_exists($k, $_SERVER))
|
||||||
|
if (strlen($_SERVER[$k]) > 0)
|
||||||
|
$strParam = $_SERVER[$k];
|
||||||
|
}
|
||||||
|
|
||||||
|
$strParam = preg_replace("/\?.*$/", "", $strParam);
|
||||||
|
|
||||||
// REQUEST_URI method:
|
// REQUEST_URI method:
|
||||||
if (strlen($strParam) < 1)
|
if (strlen($strParam) < 1)
|
||||||
@ -23,6 +36,8 @@
|
|||||||
if (strlen($_SERVER["PATH_INFO"]) > 0)
|
if (strlen($_SERVER["PATH_INFO"]) > 0)
|
||||||
$strParam = $_SERVER["PATH_INFO"];
|
$strParam = $_SERVER["PATH_INFO"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//error_log(json_encode($_SERVER, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
|
||||||
|
|
||||||
$strPath = $strParam;
|
$strPath = $strParam;
|
||||||
$strPath = preg_replace("/^\//", "", $strPath);
|
$strPath = preg_replace("/^\//", "", $strPath);
|
||||||
@ -202,9 +217,18 @@
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function log()
|
||||||
|
{
|
||||||
|
//$strPath = $_SERVER["PATH_INFO"];
|
||||||
|
|
||||||
|
error_log("[{$strPath}] INFO: " . implode(" ", func_get_args()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call this no matter what to understand the request:
|
// Call this no matter what to understand the request:
|
||||||
Request::process();
|
Request::process();
|
||||||
Request::processExtra();
|
Request::processExtra();
|
||||||
|
|
||||||
|
Request::log("");
|
||||||
?>
|
?>
|
||||||
|
Loading…
Reference in New Issue
Block a user