I've just read in a book that a good way to include paths from the root is using $_SERVER['DOCUMENT_ROOT'].'subdirectory'
. Is that better than using '../php/db/connection.php'
? What is the difference?
it's not that good of an idea to have any server-side executed files under the document root. a short whoops of misconfiguration may cost you your trade secrets or worse.
anyway, it's usually better to use "absolute" paths because then the referencing file may move around without the need to adjust the paths.