Re: accessing level above $_SERVER['DOCUMENT_ROOT']

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



LAMP wrote:
> hi,
> 
> I have this structure:
> /home/lamp/mydomain/html
> /home/lamp/mydomain/logs
> /home/lamp/mydomain/config
> etc.
> 
> html directory is the only one accessible from outside.
> 
> to access config file I can use this:
> required_once('/home/lamp/mydomain/config');
> 
> but this is the structure on my local/development machine. once the site
> is done it will be moved to "production" server and the structure will be
> /srv/www/mydomain/html
> /srv/www/mydomain/logs
> /srv/www/mydomain/config
> etc.
> 
> to "automate" the document_root I define on the begining of the page
> 
> define('HTML_PATH', $_SERVER{"DOCUMENT_ROOT']);
> define('CONFIG_PATH', $_SERVER{"DOCUMENT_ROOT'].'/../config');
> define('LOGS_PATH', $_SERVER{"DOCUMENT_ROOT'].'/../logs');
> 
> it works but I think it's not good solution. or at least - it's not nice
> solution :-)
> 
> suggestions?
> 
> afan
> 
> 

Outside of a define, you could have used dirname($_SERVER["DOCUMENT_ROOT]), but
in a define, that's not going to work.
I think you're stuck with your inelegance...

-- 
Peter Ford                              phone: 01580 893333
Developer                               fax:   01580 893399
Justcroft International Ltd., Staplehurst, Kent

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux