Apapche dynamic vhosts - document_root ??

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

    Apapche dynamic vhosts - document_root ??

    I am using dynamic vhost on my apache development server (conf at end of
    msg).

    I am using $_SERVER['DOCUMENT_ROOT'] in the sites I am working on, which, as
    you may have guessed isnt giving me the full path of the vhosts web root
    folder (Its returning the value as set in my main apache conf file as it
    should)

    Is there a way to get the full path to the web root folder from php or have
    the value for document_root automatically munged by apache ?

    dynamic-vhosts.comf
    #Simple dynamic virtual hosts
    #
    # This extract from apache2.conf implements the virtual host arrangement
    # outlined at http://www.apache.org/docs/vhosts/mass.html, using
    # mod_vhost_alias .

    # get the server name from the Host: header
    UseCanonicalNam e Off
    #
    # this log format can be split per-virtual-host based on the first field
    LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon
    CustomLog logs/access_log vcommon
    #
    # include the server name in the filenames used to satisfy requests
    VirtualDocument Root /mnt/raid/Net/%0/htdocs
    #VirtualScriptA lias /www/hosts/%0/cgi-bin


    Rick
  • Chung Leong

    #2
    Re: Apapche dynamic vhosts - document_root ??

    "Rick" <rick@intellige nce-direct.com> wrote in message
    news:2proerFo2m 1pU1@uni-berlin.de...[color=blue]
    > I am using dynamic vhost on my apache development server (conf at end of
    > msg).
    >
    > I am using $_SERVER['DOCUMENT_ROOT'] in the sites I am working on, which,[/color]
    as[color=blue]
    > you may have guessed isnt giving me the full path of the vhosts web root
    > folder (Its returning the value as set in my main apache conf file as it
    > should)
    >
    > Is there a way to get the full path to the web root folder from php or[/color]
    have[color=blue]
    > the value for document_root automatically munged by apache ?[/color]

    Try something like dirname(__FILE_ _) or dirname($_SERVE R['PHP_SELF'])


    Comment

    • Rick

      #3
      Re: Apapche dynamic vhosts - document_root ??

      Chung Leong wrote:
      [color=blue]
      > "Rick" <rick@intellige nce-direct.com> wrote in message
      > news:2proerFo2m 1pU1@uni-berlin.de...[color=green]
      >> I am using dynamic vhost on my apache development server (conf at end of
      >> msg).
      >>
      >> I am using $_SERVER['DOCUMENT_ROOT'] in the sites I am working on, which,[/color]
      > as[color=green]
      >> you may have guessed isnt giving me the full path of the vhosts web root
      >> folder (Its returning the value as set in my main apache conf file as it
      >> should)
      >>
      >> Is there a way to get the full path to the web root folder from php or[/color]
      > have[color=green]
      >> the value for document_root automatically munged by apache ?[/color]
      >
      > Try something like dirname(__FILE_ _) or dirname($_SERVE R['PHP_SELF'])[/color]

      That works fine, but not in the context in which am using server
      document_root - I really really dont want to have to hard code value for
      document_root into my project as its being developed in several locations.

      But on the same note, I really want dynamic virtual hosts - its such a
      simple hassle free soloution

      Rick

      Comment

      Working...