From 4240785fc74999b5b71a5c4a2bbacd3931ce1808 Mon Sep 17 00:00:00 2001 From: Daniel Hensby Date: Tue, 19 Apr 2016 07:54:11 +0100 Subject: [PATCH] Check whether run from cli or from web request within cli-script.php (#3984) * ENHANCEMENT - Improved access determination * ENHANCEMENT - Added an additional check for the existence of the mod_rewrite module --- cli-script.php | 2 +- dev/install/install.php5 | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/cli-script.php b/cli-script.php index 48a87b38d..d72c8645a 100755 --- a/cli-script.php +++ b/cli-script.php @@ -13,7 +13,7 @@ /** * Ensure that people can't access this from a web-server */ -if(isset($_SERVER['HTTP_HOST'])) { +if(PHP_SAPI != "cli" && PHP_SAPI != "cgi" && PHP_SAPI != "cgi-fcgi") { echo "cli-script.php can't be run from a web request, you have to run it on the command-line."; die(); } diff --git a/dev/install/install.php5 b/dev/install/install.php5 index 4481d313c..0953a2961 100755 --- a/dev/install/install.php5 +++ b/dev/install/install.php5 @@ -980,7 +980,9 @@ class InstallRequirements { return true; } elseif(isset($_SERVER['HTTP_MOD_REWRITE']) && $_SERVER['HTTP_MOD_REWRITE'] == 'On') { return true; - } else { + } elseif(isset($_SERVER['REDIRECT_HTTP_MOD_REWRITE']) && $_SERVER['REDIRECT_HTTP_MOD_REWRITE'] == 'On') { + return true; + } else { return false; } }