Topic: "To trust DOCUMENT_ROOT, or not to trust DOCUMENT_ROOT?"
According to several things which I have read on Apache's website, it seems that using $_SERVER['DOCUMENT_ROOT'] to detect a web site's root on its server within server-side applications is "bad practice." After reading this, I was worried that my slightly-enhanced Apache configuration, which makes use of VirtualDocumentRoot (destroying DocumentRoot's "reliability"), would screw-over my favorite PHP applications, like PunBB. (This assumption comes from the fact that I have seen a handful of PHP applications rely on $_SERVER['DOCUMENT_ROOT'] in the context described above.) As such, I began glancing over a tad bit of the PunBB sourcecode, looking to see if any problems may arise. As soon as I opened up index.php, I noticed that PunBB uses the following method to assign PunBB's root directory:
This method, if I am not mistaken, should not conflict whatsoever with the lack of a "valid" DocumentRoot. Am I right? (I am assuming that if $_SERVER['DOCUMENT_ROOT'] is not used there, it is not used anywhere else for this purpose.) I have not gotten the chance to transfer my PunBB installation over to the server which is using this new Apache configuration, because I am still finishing up some of the changes on the configuration and whatnot; as such, I am merely trying to check ahead of time before I get too far.