Inside of a Drupal module I need to obtain the base path where the Drupal site is installed.
For example, if the drupal site is installed at: www.example.com/mysite/ then I want to get '/var/www/myseite'
If it is installed in: www.example.com/ then I want '/var/www'
What is the proper Drupal way to get this? I want to avoid PHP's server variables, as I read they are unreliable.
(Drupal 6 and Drupal 7)