I'm having a problem with $_SERVER['DOCUMENT_ROOT']. On my home machine (using wamp on win7) the following code works perfect, however when I uploaded it to my host it broke saying unable to find the file, it was clearly missing a directory separator. Is this just a difference between linux and windows? Is there a way around this so that I don't have to change my code whenever I upload to a linux server? I can add . DIRECTORY_SEPARATOR to the definition however this is creating an extra separator on windows (atleast with wamp) the includes still work even with the extra / which is also confusing to me. Is this normal behavior?
$_SERVER manual page and user contributions don't really seem to answer this question, and I'm trying to save headaches when porting to different server enviroments.
// Only works locally
define('DOC_ROOT',$_SERVER['DOCUMENT_ROOT']);
require_once(DOC_ROOT . 'application/config/config.php');
// works locally and on host, even tho extra slash locally
define('DOC_ROOT',$_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR);
require_once(DOC_ROOT . 'application/config/config.php');