<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.filesystem.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'de',
  ),
  'this' => 
  array (
    0 => 'function.realpath.php',
    1 => 'realpath',
    2 => 'L&ouml;st einen Pfad in einen absoluten und eindeutigen auf',
  ),
  'up' => 
  array (
    0 => 'ref.filesystem.php',
    1 => 'Dateisystem',
  ),
  'prev' => 
  array (
    0 => 'function.readlink.php',
    1 => 'readlink',
  ),
  'next' => 
  array (
    0 => 'function.realpath-cache-get.php',
    1 => 'realpath_cache_get',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'de',
    'path' => 'reference/filesystem/functions/realpath.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.realpath" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">realpath</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">realpath</span> &mdash; <span class="dc-title">Löst einen Pfad in einen absoluten und eindeutigen auf</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.realpath-description">
  <h3 class="title">Beschreibung</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>realpath</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$path</code></span>): <span class="type"><span class="type"><a href="language.types.string.php" class="type string">string</a></span>|<span class="type"><a href="language.types.singleton.php" class="type false">false</a></span></span></div>

  <p class="para rdfs-comment">
   <span class="function"><strong>realpath()</strong></span> löst alle symbolischen Verweise,
   <code class="literal">/./</code>, <code class="literal">/../</code> und mehrere aufeinanderfolgende <code class="literal">/</code> Zeichen,
   die in <code class="parameter">path</code> enthalten sind, auf und gibt
   den so entstehenden absoluten Pfad zurück.
  </p>
 </div>

 
 <div class="refsect1 parameters" id="refsect1-function.realpath-parameters">
  <h3 class="title">Parameter-Liste</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">path</code></dt>
     <dd>
      <p class="para">
       Der Pfad, der aufgelöst werden soll.
       <blockquote class="note"><p><strong class="note">Hinweis</strong>: 
        <p class="para">
         Der Pfad muss angegeben werden, kann allerdings auch ein leerer String
         sein, in diesem Fall wird dann das aktuelle Verzeichnis
         benutzt.
        </p>
       </p></blockquote>
      </p>
     </dd>
    
   </dl>
  </p>
 </div>

 
 <div class="refsect1 returnvalues" id="refsect1-function.realpath-returnvalues">
  <h3 class="title">Rückgabewerte</h3>
  <p class="para">
   Gibt bei Erfolg den eindeutigen und absoluten Pfadnamen zurück. Dieser wird
   keine symbolischen Links, <code class="literal">/./</code> oder <code class="literal">/../</code> mehr enthalten.
   Abschließende Trennzeichen wie <code class="literal">\</code> und <code class="literal">/</code> werden ebenfalls entfernt.
  </p>
  <p class="para">
   <span class="function"><strong>realpath()</strong></span> gibt <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> zurück, wenn ein Fehler auftritt, 
   beispielsweise wenn die Datei nicht existiert.
  </p>
  <blockquote class="note"><p><strong class="note">Hinweis</strong>: 
   <p class="para">
    Das ausführende Script muss alle Verzeichnisse im Pfad öffnen können
    (auf unixoiden Systemen wäre das das &quot;execute&quot; Recht). Ist dies nicht
    der Fall, gibt <span class="function"><strong>realpath()</strong></span> <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> zurück.
   </p>
  </p></blockquote>
  <blockquote class="note"><p><strong class="note">Hinweis</strong>: 
   <p class="para">
    Bei Dateisystemen, bei denen Groß-/Kleinschreibung keine Rolle spielt,
    kann <span class="function"><strong>realpath()</strong></span> die Schreibweise kanonisieren, oder auch
    nicht.
   </p>
  </p></blockquote>
  <blockquote class="note"><p><strong class="note">Hinweis</strong>: 
   <p class="para">
    Die Funktion <span class="function"><strong>realpath()</strong></span> funktioniert nicht für Dateien in
    einem Phar, da solche Pfade virtuelle Pfade sind, aber keine realen Pfade.
   </p>
  </p></blockquote>
  <blockquote class="note"><p><strong class="note">Hinweis</strong>: 
   <p class="para">
    Unter Windows werden Junctions und symbolische Links zu Verzeichnissen nur
    um eine Ebene erweitert.
   </p>
  </p></blockquote>
  <blockquote class="note"><p><strong class="note">Hinweis</strong>: <span class="simpara">
Weil PHPs Integer Typ vorzeichenbehaftet ist und viele Platformen 32bit Integer
verwenden, können einige Dateisystem-Funktionen für Dateien größer als 2GB unerwartete
Ergebnisse liefern.
</span></p></blockquote>
 </div>

 
 <div class="refsect1 examples" id="refsect1-function.realpath-examples">
  <h3 class="title">Beispiele</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Beispiel #1 <span class="function"><strong>realpath()</strong></span></strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />chdir</span><span style="color: #007700">(</span><span style="color: #DD0000">'/var/www/'</span><span style="color: #007700">);<br />echo </span><span style="color: #0000BB">realpath</span><span style="color: #007700">(</span><span style="color: #DD0000">'./../../etc/passwd'</span><span style="color: #007700">) . </span><span style="color: #0000BB">PHP_EOL</span><span style="color: #007700">;<br /><br /><br />echo </span><span style="color: #0000BB">realpath</span><span style="color: #007700">(</span><span style="color: #DD0000">'/tmp/'</span><span style="color: #007700">) . </span><span style="color: #0000BB">PHP_EOL</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

    <div class="example-contents"><p>Das oben gezeigte Beispiel erzeugt folgende Ausgabe:</p></div>
    <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">/etc/passwd
/tmp</pre>
</div>
    </div>
   </div>
   <div class="example" id="example-2">
    <p><strong>Beispiel #2 <span class="function"><strong>realpath()</strong></span> auf Windows</strong></p>
    <div class="example-contents"><p>
     Unter Windows wandelt <span class="function"><strong>realpath()</strong></span> Unix-artige
     Pfade in gültige Windows-Pfade um:
    </p></div>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">realpath</span><span style="color: #007700">(</span><span style="color: #DD0000">'/windows/system32'</span><span style="color: #007700">), </span><span style="color: #0000BB">PHP_EOL</span><span style="color: #007700">;<br /><br />echo </span><span style="color: #0000BB">realpath</span><span style="color: #007700">(</span><span style="color: #DD0000">'C:\Program Files\\'</span><span style="color: #007700">), </span><span style="color: #0000BB">PHP_EOL</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

    <div class="example-contents"><p>Das oben gezeigte Beispiel erzeugt folgende Ausgabe:</p></div>
    <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">C:\WINDOWS\System32
C:\Program Files</pre>
</div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.realpath-seealso">
  <h3 class="title">Siehe auch</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.basename.php" class="function" rel="rdfs-seeAlso">basename()</a> - Liefert den letzten Namensteil einer Pfadangabe</span></li>
    <li><span class="function"><a href="function.dirname.php" class="function" rel="rdfs-seeAlso">dirname()</a> - Liefert den Pfad des &uuml;bergeordneten Verzeichnisses</span></li>
    <li><span class="function"><a href="function.pathinfo.php" class="function" rel="rdfs-seeAlso">pathinfo()</a> - Liefert Informationen &uuml;ber einen Dateipfad</span></li>
   </ul>
  </p>
 </div>

</div><?php manual_footer($setup); ?>