[SOLVED] $_SERVER['DOCUMENT_ROOT']

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bladecatcher
Forum Commoner
Posts: 67
Joined: Sat Mar 12, 2005 12:50 am

[SOLVED] $_SERVER['DOCUMENT_ROOT']

Post by bladecatcher »

G'day All,
I have a named virtual host test.mysite.com
<VirtualHost *>
DocumentRoot /var/www/test
ServerName http://www.test.mysite.com
ServerAlias test.mysite.com
</VirtualHost>

Code: Select all

$docroot = dirname($_SERVER['DOCUMENT_ROOT'].'/');
$docroot returns "/var/www/" not "/var/www/test/"

Would some kind soul point my to a url where I can get my head around my mistake please?

Thanking you in anticipation,
bladecatcher
bladecatcher
Forum Commoner
Posts: 67
Joined: Sat Mar 12, 2005 12:50 am

solved

Post by bladecatcher »

was staring me in the face 8-0
I was returning the parent directory, doh.


$docroot = $_SERVER['DOCUMENT_ROOT'];

works well.
Post Reply