Improved detection of abs and web root paths

whimmel wrote on Friday, August 26, 2011:

(never realized how short that subject line field is here)

https://github.com/whimmel/openemr/tree/long-webroot

This method (adapted from an answer on stackoverflow) does a better job of determining the absolute and webroot paths of the EMR’s installation.

I’ve had to hardcode the paths previously because most of my installs involve a symlink from the DocumentRoot to somewhere else in the filesystem, particularly my development workspaces.

For example:

/var/www is the DocumentRoot
/var/www/workspace -> /home/whimmel/workspace is the symbolic link
/home/whimmel/workspace/openemr is where my local git repos lives

The existing assumption made on strlen($_SERVER trims off 8 characters and sets $webroot to be:

immel/workspace/openemr

Which clearly won’t work for me.

bradymiller wrote on Monday, August 29, 2011:

Tested fine, so committed (didn’t try symlinks) to master and rel-410 branch. Didn’t test windows, but that will be covered by other testers.
thanks for the contribution,
-brady