From 8ffe42163e208d0b35272899f1e510d3af50f3ff Mon Sep 17 00:00:00 2001 From: bradymiller Date: Sun, 1 Jun 2014 03:31:12 -0700 Subject: [PATCH] Fix for webserver_root and web_root variables in windows. -Note this has debugging lines in that need to be removed before official commit. --- interface/globals.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/interface/globals.php b/interface/globals.php index 55dc761bb..28519b830 100644 --- a/interface/globals.php +++ b/interface/globals.php @@ -60,13 +60,19 @@ if (IS_WINDOWS) { //convert windows path separators $webserver_root = str_replace("\\","/",$webserver_root); } +// Collect the apache server document root (and convert to windows slashes, if needed) +$server_document_root = $_SERVER['DOCUMENT_ROOT']; +if (IS_WINDOWS) { + //convert windows path separators + $server_document_root = str_replace("\\","/",$server_document_root); +} // Auto collect the relative html path, i.e. what you would type into the web // browser after the server address to get to OpenEMR. // This removes the leading portion of $webserver_root that it has in common with the web server's document // root and assigns the result to $web_root. In addition to the common case where $webserver_root is // /var/www/openemr and document root is /var/www, this also handles the case where document root is // /var/www/html and there is an Apache "Alias" command that directs /openemr to /var/www/openemr. -$web_root = substr($webserver_root, strspn($webserver_root ^ $_SERVER['DOCUMENT_ROOT'], "\0")); +$web_root = substr($webserver_root, strspn($webserver_root ^ $server_document_root, "\0")); // Ensure web_root starts with a path separator if (preg_match("/^[^\/]/",$web_root)) { $web_root = "/".$web_root; -- 2.11.4.GIT