Referring to the public root in PHP - best practices
Posted
by Emanuil
on Stack Overflow
See other posts from Stack Overflow
or by Emanuil
Published on 2010-06-08T16:06:40Z
Indexed on
2010/06/08
16:22 UTC
Read the original article
Hit count: 429
php
|best-practices
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 approach would you recommend?
© Stack Overflow or respective owner