$_SERVER['DOCUMENT_ROOT']

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jeff

    $_SERVER['DOCUMENT_ROOT']

    Is $_SERVER['DOCUMENT_ROOT'] alway available?

    I ask this because I've seen on windows that the perl equivalent was
    missing. Is this settable and accessible the same way (ie not having to
    use global)?

    Jeff
  • =?iso-8859-1?Q?=C1lvaro?= G. Vicario

    #2
    Re: $_SERVER['DOCUMENT_ROOT']

    *** Jeff escribió/wrote (Sun, 03 Aug 2008 11:00:52 -0400):
    Is $_SERVER['DOCUMENT_ROOT'] alway available?
    Not necessarily. And even if it exists it might be wrong (I've seen such
    case in GoDaddy).


    Whatever the case, $_SERVER is not write-only.


    --
    -- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
    -- Mi sitio sobre programación web: http://bits.demogracia.com
    -- Mi web de humor en cubitos: http://www.demogracia.com
    --

    Comment

    • Jerry Stuckle

      #3
      Re: $_SERVER['DOCUMENT_ROOT']

      Álvaro G. Vicario wrote:
      *** Jeff escribió/wrote (Sun, 03 Aug 2008 11:00:52 -0400):
      > Is $_SERVER['DOCUMENT_ROOT'] alway available?
      >
      Not necessarily. And even if it exists it might be wrong (I've seen such
      case in GoDaddy).
      >
      >
      Whatever the case, $_SERVER is not write-only.
      >
      >
      If you're running PHP as a module, then yes, it is available. As a CGI,
      generally not.

      I've never seen it wrong - it comes directly from the server. If it is
      incorrect, there is a major server configuration problem or the script
      itself is messing things up. And if it were server configuration, I
      would expect to see other problems as well.

      Also, I think mean it is not READ_ONLY. Which is true - anyone can
      write to it. But that's true of all of the superglobals.

      --
      =============== ===
      Remove the "x" from my email address
      Jerry Stuckle
      JDS Computer Training Corp.
      jstucklex@attgl obal.net
      =============== ===

      Comment

      • Michael Fesser

        #4
        Re: $_SERVER['DOCUMENT_ROOT']

        ..oO(Jerry Stuckle)
        >Álvaro G. Vicario wrote:
        >*** Jeff escribió/wrote (Sun, 03 Aug 2008 11:00:52 -0400):
        >> Is $_SERVER['DOCUMENT_ROOT'] alway available?
        >>
        >Not necessarily. And even if it exists it might be wrong (I've seen such
        >case in GoDaddy).
        >>
        >>
        >Whatever the case, $_SERVER is not write-only.
        >>
        >>
        >
        >If you're running PHP as a module, then yes, it is available. As a CGI,
        >generally not.
        On Apache servers it should always be available, regardless of the SAPI.
        One of my hosts runs PHP as FastCGI and the docroot variable is there.
        >I've never seen it wrong - it comes directly from the server. If it is
        >incorrect, there is a major server configuration problem or the script
        >itself is messing things up.
        Agreed.

        Micha

        Comment

        • Jerry Stuckle

          #5
          Re: $_SERVER['DOCUMENT_ROOT']

          Michael Fesser wrote:
          .oO(Jerry Stuckle)
          >
          >Álvaro G. Vicario wrote:
          >>*** Jeff escribió/wrote (Sun, 03 Aug 2008 11:00:52 -0400):
          >>> Is $_SERVER['DOCUMENT_ROOT'] alway available?
          >>Not necessarily. And even if it exists it might be wrong (I've seen such
          >>case in GoDaddy).
          >>>
          >>>
          >>Whatever the case, $_SERVER is not write-only.
          >>>
          >>>
          >If you're running PHP as a module, then yes, it is available. As a CGI,
          >generally not.
          >
          On Apache servers it should always be available, regardless of the SAPI.
          One of my hosts runs PHP as FastCGI and the docroot variable is there.
          >
          >I've never seen it wrong - it comes directly from the server. If it is
          >incorrect, there is a major server configuration problem or the script
          >itself is messing things up.
          >
          Agreed.
          >
          Micha
          Good do know, Micha - thanks. But I know on IIS servers is is not
          available if you run as a cgi.

          --
          =============== ===
          Remove the "x" from my email address
          Jerry Stuckle
          JDS Computer Training Corp.
          jstucklex@attgl obal.net
          =============== ===

          Comment

          • Jeff

            #6
            Re: $_SERVER['DOCUMENT_ROOT']

            Jerry Stuckle wrote:
            Michael Fesser wrote:
            >.oO(Jerry Stuckle)
            >>
            >>Álvaro G. Vicario wrote:
            >>>*** Jeff escribió/wrote (Sun, 03 Aug 2008 11:00:52 -0400):
            >>>> Is $_SERVER['DOCUMENT_ROOT'] alway available?
            >>>Not necessarily. And even if it exists it might be wrong (I've seen
            >>>such
            >>>case in GoDaddy).
            >>>>
            >>>>
            >>>Whatever the case, $_SERVER is not write-only.
            >>>>
            >>>>
            >>If you're running PHP as a module, then yes, it is available. As a
            >>CGI, generally not.
            >>
            >On Apache servers it should always be available, regardless of the SAPI.
            >One of my hosts runs PHP as FastCGI and the docroot variable is there.
            >>
            >>I've never seen it wrong - it comes directly from the server. If it
            >>is incorrect, there is a major server configuration problem or the
            >>script itself is messing things up.
            >>
            >Agreed.
            >>
            >Micha
            >
            Good do know, Micha - thanks. But I know on IIS servers is is not
            available if you run as a cgi.
            That would explain why the perl equivalent under IIS is not there as
            perl typically runs as a CGI.

            I'm running php on the same IIS server and $_SERVER['DOCUMENT_ROOT']
            is visible, so this must be because it is running as a module. Is the
            module preferred and more common under IIS? I sometimes do some work in
            IIS and I've always found that perl was a bit brain dead about where it
            was. This must be the cgi issue again. I'm not sure exactly what it is
            but my general experience with windows administrators is that they have
            more questions than answers!

            Jeff
            >

            Comment

            • nice.guy.nige

              #7
              Re: $_SERVER['DOCUMENT_ROOT']

              While the city slept, Álvaro G. Vicario feverishly typed:
              Whatever the case, $_SERVER is not write-only.
              Which is good, as write-only data is rarely useful ;-)

              Cheers,
              Nige

              --
              Nigel Moss | http://www.nigenet.org.uk
              Email not valid. nigel@dog.nigen et.org.uk - take the dog out!
              "You're mother ate my dog!", "Not all of him..."


              Comment

              Working...