Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #14569

Re: Getting the website document root portably (Apache, IIS, maybe others) and simply

From "M. Strobel" <sorry_no_mail_here@nowhere.dee>
Newsgroups comp.lang.php
Subject Re: Getting the website document root portably (Apache, IIS, maybe others) and simply
Date 2014-11-13 21:53 +0100
Message-ID <cckk2rF6dq5U1@mid.uni-berlin.de> (permalink)
References <m42m6j$6vd$1@dont-email.me>

Show all headers | View raw


On 13.11.2014 17:28, James Harris wrote:
> This is a question that has been asked before but there seems no consensus
> in the answers given out there in internet land so I wonder if folks on this
> newsgroup can recommend a currently accepted best-practice solution. What
> should a PHP file do in order to find out the "document root"? I am looking
> for a solution that is portable across different web servers and OSes and is
> simple enough to be present verbatim on any page which needs such info.
>

My 2 ยข

In a code base serving several virtual hosts from the same location (apache2 
ServerAlias, or completely separate) I started putting the document root in a db 
config table, so I would have an easy way to combine or separate document roots 
depending on server names (HTTP_HOST).

Together with a config file named after _SERVER[HTTP_HOST] this gave me (and the app) 
flexibility and stability.

/Str.

Back to comp.lang.php | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Getting the website document root portably (Apache, IIS, maybe others) and simply "James Harris" <james.harris.1@gmail.com> - 2014-11-13 16:28 +0000
  Re: Getting the website document root portably (Apache, IIS, maybe others) and simply "J.O. Aho" <user@example.net> - 2014-11-13 18:38 +0100
    Re: Getting the website document root portably (Apache, IIS, maybe others) and simply Matthew Carter <m@ahungry.com> - 2014-11-13 14:32 -0500
      Re: Getting the website document root portably (Apache, IIS, maybe others) and simply "Christoph M. Becker" <cmbecker69@arcor.de> - 2014-11-13 20:58 +0100
      Re: Getting the website document root portably (Apache, IIS, maybe others) and simply "James Harris" <james.harris.1@gmail.com> - 2014-11-13 20:06 +0000
    Re: Getting the website document root portably (Apache, IIS, maybe others) and simply crankypuss <crankypuss@nomail.invalid> - 2014-11-14 02:35 -0700
  Re: Getting the website document root portably (Apache, IIS, maybe others) and simply "Christoph M. Becker" <cmbecker69@arcor.de> - 2014-11-13 21:04 +0100
  Re: Getting the website document root portably (Apache, IIS, maybe others) and simply "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2014-11-13 21:53 +0100
  Re: Getting the website document root portably (Apache, IIS, maybe others) and simply Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-11-13 22:54 +0100

csiph-web