It is possible to means by PHP to obtain the hostname and document root in the server? Let me do that without storing them as variables inside your php code. I'm unwilling to use $_SERVER because I've heard it's not reliable and susceptible to attack. How is this done on the virtual host? Does a trusted and safe method exist?