1 (edited by Jeef 2006-12-14 03:17)

Topic: "To trust DOCUMENT_ROOT, or not to trust DOCUMENT_ROOT?"

According to several things[1] 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:

define('PUN_ROOT', './');

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.

[1] See: http://httpd.apache.org/docs/2.2/vhosts … l#overview and http://issues.apache.org/bugzilla/show_bug.cgi?id=26052

Re: "To trust DOCUMENT_ROOT, or not to trust DOCUMENT_ROOT?"

PunBB does not use $_SERVER['DOCUMENT_ROOT']

http://fluxbb.org

Free PunBB Hosting - lots of mods, easy to customize

3

Re: "To trust DOCUMENT_ROOT, or not to trust DOCUMENT_ROOT?"

Sweet! Thanks for the information. I guess this means I shouldn't have any complications when I switch my PunBB installation over to the new server. big_smile