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/api.elmsln.org/includes/bootstrap.inc).
cis7 file.inc drupal_realpath($uri)
cle7 file.inc drupal_realpath($uri)
elmsmedia7 file.inc drupal_realpath($uri)
icor7 file.inc drupal_realpath($uri)
meedjum_blog7 file.inc drupal_realpath($uri)
mooc7 file.inc 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.

Parameters

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

DrupalStreamWrapperInterface::realpath()

http://php.net/manual/function.realpath.php

Related topics

34 calls to drupal_realpath()
archiver_get_archiver in includes/common.inc
Creates the appropriate archiver for the specified file.
backup_file::filepath in sites/all/modules/ulmus/backup_migrate/includes/files.inc
Get the current filepath.
backup_migrate_destination_files::check_web_dir in sites/all/modules/ulmus/backup_migrate/includes/destinations.file.inc
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/destinations.file.inc
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/destinations.file.inc
Get the file location.

... See full list

File

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

Code

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;
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.