473,408 Members | 2,832 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

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
UseCanonicalName 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
VirtualDocumentRoot /mnt/raid/Net/%0/htdocs
#VirtualScriptAlias /www/hosts/%0/cgi-bin
Rick
Jul 17 '05 #1
2 2687
"Rick" <ri**@intelligence-direct.com> wrote in message
news:2p************@uni-berlin.de...
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 ?


Try something like dirname(__FILE__) or dirname($_SERVER['PHP_SELF'])
Jul 17 '05 #2
Chung Leong wrote:
"Rick" <ri**@intelligence-direct.com> wrote in message
news:2p************@uni-berlin.de...
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 ?


Try something like dirname(__FILE__) or dirname($_SERVER['PHP_SELF'])


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

Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: olafmol | last post by:
Hello, on my windows NT4 server with IIS4 and PHP Version 4.3.1 i don't have any "DOCUMENT_ROOT" environment var. Is there any reason i dont get this? Can i do something about it? I need this...
2
by: Frederik Himpe | last post by:
When you publish a website in /home/username/public_html and make it availabe with the mod_userdir apache module, it can be accessed via http://server/~username/. In that case though, the...
6
by: Tom | last post by:
I'm trying to dynamically adjust the path for one of my scripts using this: $script_path = str_replace( $_SERVER, "", dirname(realpath(__FILE__)) ) . DIRECTORY_SEPARATOR; The problem: the...
4
by: Chris | last post by:
I'm working on a large intranet group site with a lot of pages, file types, folders, subfolders, etc. I am using the include ('../includes/file.php') , but I would like to have a single snippet...
1
by: Satish.Talyan | last post by:
hi, i want to create a dynamic tree hierarchy in javascript.there are two parts in tree, group & user.when we click on group then users come under that's tree category will be opened.problem is...
4
by: monomaniac21 | last post by:
Why does this find the file: <img src="<?=$_SERVER?>/images/viessmann_header_logo.gif"> But this does not? $right_content = $_SERVER."includes/content/content.php";
12
by: comp.lang.php | last post by:
Env: Windows XP, Apache 1.33, PHP 5.2.0 <? echo is_dir($_SERVER) . " for dir = " . $_SERVER); ?>
2
by: thetechturf.com | last post by:
I have some simple dynamic content pages (included below). I need to know how to add specific meta tags (ie. description, keywords, ect.), as well as extra specific header coding to a page. I would...
0
by: avadhesh33 | last post by:
As we wanr Dynamic Subdomains It means we want to allow any of text in place of "www" like.. abc.domain.com xyz.domain.com ....... *.domain.com
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.