View previous topic :: View next topic |
Author |
Message |
sigmalll Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
![](images/avatars/142210387240308597f1d39.gif)
Joined: 24 Aug 2003 Posts: 332
|
Posted: Tue Aug 31, 2004 2:18 pm Post subject: Apache2 + dynamic-vhosts = broken PHP document_root |
|
|
I have a simple vhost setup using dynamic-vhosts.conf
Code: | #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/dev/htdocs
#VirtualScriptAlias /www/hosts/%0/cgi-bin
#
# This configuration can be changed into an IP-based virtual hosting
# solution by just turning UseCanonicalName Off into UseCanonicalName DNS.
# The server name that is inserted into the filename is then derived from
# the IP address of the virtual host.
<Directory /mnt/raid/Net>
Options Includes Indexes FollowSymLinks
AllowOverride FileInfo
allow from all
</Directory>
|
All working fine, I can create new hosts by just creating the relavent dirs.
The problem is that for all my vhosted sites the PHP variable document_root returns the default value from apache2.conf NOT the document root of the actual vhost
how can I get this fixed? |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
sigmalll Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
![](images/avatars/142210387240308597f1d39.gif)
Joined: 24 Aug 2003 Posts: 332
|
Posted: Fri Sep 03, 2004 11:43 am Post subject: |
|
|
bump - anybody? |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
yerhus n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 18 Apr 2002 Posts: 7 Location: Portugal
|
Posted: Mon Dec 20, 2004 3:47 pm Post subject: |
|
|
I have the same problem... is there any solution? |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
sigmalll Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
![](images/avatars/142210387240308597f1d39.gif)
Joined: 24 Aug 2003 Posts: 332
|
Posted: Tue Dec 21, 2004 11:12 am Post subject: |
|
|
I ended up using a little PHP to work out the real document root. I have a shared library of code that I pointed the apache document root at and all my pages start by loading an init script thats in this 'common' document root.
I then work out the actual document root and update that server var.
Dunno how useful the following will be to you
Code: |
$root = explode("httpdocs", dirname($_SERVER['SCRIPT_FILENAME']));
$root = $root[0].'httpdocs';
$_SERVER['DOCUMENT_ROOT'] = $root;
|
|
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|