Referring to the public root in PHP - best practices
- by Emanuil
I've been using the $_SERVER["DOCUMENT_ROOT"] environment variable to refer to the public root in my apps. Now I'm realizing that that's not very reliable. I'm thinking about an approach where I define a constant in my index.php based on a magic constant. Something like that:
define("PUBILC", __DIR__);
I'm not sure about it though.
What…