From adf4751a4a281ea3d09ce2602bccfdbfabb472d7 Mon Sep 17 00:00:00 2001 From: bradymiller Date: Sun, 27 Apr 2014 17:53:23 -0700 Subject: [PATCH] fixed web_root path to work with simple soft link -for example, if place a soft link in /var/www/html/openemr which links to /var/www/openemr --- interface/globals.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/interface/globals.php b/interface/globals.php index dc8182b4d..55dc761bb 100644 --- a/interface/globals.php +++ b/interface/globals.php @@ -62,7 +62,11 @@ if (IS_WINDOWS) { } // Auto collect the relative html path, i.e. what you would type into the web // browser after the server address to get to OpenEMR. -$web_root = substr($webserver_root, strlen($_SERVER['DOCUMENT_ROOT'])); +// 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")); // Ensure web_root starts with a path separator if (preg_match("/^[^\/]/",$web_root)) { $web_root = "/".$web_root; -- 2.11.4.GIT