As already suggested there are $_SERVER variables that can assist you here. Although if you plan on having an include file that will be included by every script in your site you could also use the __FILE__ constant. In your case the following would work:

// main.inc.php, located in /home/virtual/sitename.com/var/www/html/
$path = dirname(__FILE__) . '/';

// now all relative includes with $path prefix should correctly resolve
// to absolute pathnames

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



Reply via email to