Previously we talked about how to get the absolute file path of your Drupal installation.
Drupal – Get the absolute file path of your Drupal installation
There are also other ways to get different file paths in Drupal. Suppose the Drupal webroot path is /var/www/drupal.
print variable_get('file_public_path', conf_path() . '/files');
// output: sites/default/files
print drupal_realpath(file_default_scheme() . '://');
// output: /var/www/drupal/sites/default/files
print realpath(".");
// output: /var/www/drupal
Done =)
