function drupal_realpath


Error message

User warning: The following module is missing from the file system: theme/theme. For information about how to fix this, see the documentation page. in _drupal_trigger_error_with_delayed_logging() (line 1156 of /var/www/html/elmsln_community/
cis7 drupal_realpath($uri)
cle7 drupal_realpath($uri)
elmsmedia7 drupal_realpath($uri)
icor7 drupal_realpath($uri)
meedjum_blog7 drupal_realpath($uri)
mooc7 drupal_realpath($uri)

Resolves the absolute filepath of a local URI or filepath.

The use of drupal_realpath() is discouraged, because it does not work for remote URIs. Except in rare cases, URIs should not be manually resolved.

Only use this function if you know that the stream wrapper in the URI uses the local file system, and you need to pass an absolute path to a function that is incompatible with stream URIs.


string $uri: A stream wrapper URI or a filepath, possibly including one or more symbolic links.

Return value

string|false The absolute local filepath (with no symbolic links), or FALSE on failure.

See also


Related topics

34 calls to drupal_realpath()
archiver_get_archiver in includes/
Creates the appropriate archiver for the specified file.
backup_file::filepath in sites/all/modules/ulmus/backup_migrate/includes/
Get the current filepath.
backup_migrate_destination_files::check_web_dir in sites/all/modules/ulmus/backup_migrate/includes/
Check that a web accessible directory has been properly secured, othewise attempt to secure it.
backup_migrate_destination_files::dir_in_webroot in sites/all/modules/ulmus/backup_migrate/includes/
Check if the given directory is within the webroot and is therefore web accessible.
backup_migrate_destination_files::get_realpath in sites/all/modules/ulmus/backup_migrate/includes/
Get the file location.

... See full list


includes/, line 2259
API for handling file uploads and server file management.


function drupal_realpath($uri) {
  // If this URI is a stream, pass it off to the appropriate stream wrapper.
  // Otherwise, attempt PHP's realpath. This allows use of drupal_realpath even
  // for unmanaged files outside of the stream wrapper interface.
  if ($wrapper = file_stream_wrapper_get_instance_by_uri($uri)) {
    return $wrapper->realpath();
  // Check that the URI has a value. There is a bug in PHP 5.2 on *BSD systems
  // that makes realpath not return FALSE as expected when passing an empty
  // variable.
  // @todo Remove when Drupal drops support for PHP 5.2.
  elseif (!empty($uri)) {
    return realpath($uri);
  return FALSE;