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


Groups > comp.lang.php > #14565

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

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!weretis.net!feeder4.news.weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From "Christoph M. Becker" <cmbecker69@arcor.de>
Newsgroups comp.lang.php
Subject Re: Getting the website document root portably (Apache, IIS, maybe others) and simply
Date Thu, 13 Nov 2014 21:04:03 +0100
Organization solani.org
Lines 16
Message-ID <m432rb$llt$1@solani.org> (permalink)
References <m42m6j$6vd$1@dont-email.me>
Mime-Version 1.0
Content-Type text/plain; charset=iso-8859-15
Content-Transfer-Encoding 7bit
X-Trace solani.org 1415909035 22205 eJwNwokRwDAIA7CZ+BwYh5iw/wjtSWEQ8DgCHht73om8JcqfIdXGqqcq/Sbt0Zd0ndbYFtQHEqsREQ== (13 Nov 2014 20:03:55 GMT)
X-Complaints-To abuse@news.solani.org
NNTP-Posting-Date Thu, 13 Nov 2014 20:03:55 +0000 (UTC)
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0
X-User-ID eJwNyskBwCAIBMCWROQqJ8Ju/yWYeY+pi3ccNz9GoyZR0tFfRexcQd1LEvcWWKMw4B8cTRtiHiMLEhs=
In-Reply-To <m42m6j$6vd$1@dont-email.me>
Cancel-Lock sha1:VqNkE1Avcht8146UMKf75BdeVqY=
X-NNTP-Posting-Host eJwFwQERADEIAzBL5YAO5Ozh61/CknQa5wSTkUoth2anAKHdm1X48iowUSr0zn9Cd7Deoj0GpBCt
Xref csiph.com comp.lang.php:14565

Show key headers only | View raw


James Harris wrote:

> Hence the question: is there a simple, 
> portable way to get the web site's base directory in a form that is easy to 
> use in subsequent PHP code?

If the PHP script is placed in the webroot you can use:

  realpath('.')

If the script is placed somewhere else use the respective relative path
to the webroot as argument.  In most cases you don't need an absolute
path, though.

-- 
Christoph M. Becker

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