<?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 => 'fr',
  ),
  'this' => 
  array (
    0 => 'function.realpath.php',
    1 => 'realpath',
    2 => 'Retourne le chemin canonique absolu',
  ),
  'up' => 
  array (
    0 => 'ref.filesystem.php',
    1 => 'Fonctions sur les syst&egrave;mes de fichiers',
  ),
  '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' => 'fr',
    '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">Retourne le chemin canonique absolu</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.realpath-description">
  <h3 class="title">Description</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> résout tous les liens symboliques, et
   remplace toutes les références <code class="literal">/./</code>, <code class="literal">/../</code>
   et <code class="literal">/</code> de <code class="parameter">path</code> puis retourne
   le chemin canonique absolu ainsi trouvé.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.realpath-parameters">
  <h3 class="title">Liste de paramètres</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">path</code></dt>
     <dd>
      <p class="para">
       Le chemin à vérifier.
       <blockquote class="note"><p><strong class="note">Note</strong>: 
        <p class="para">
         Un chemin d&#039;accès doit être fourni, la valeur peut être une chaîne de caractères vide.
         Dans ces cas, la valeur est interprétée comme étant le dossier courant.
        </p>
       </p></blockquote>
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.realpath-returnvalues">
  <h3 class="title">Valeurs de retour</h3>
  <p class="para">
   Retourne le chemin canonique absolu
   ainsi trouvé. Le résultat ne contient aucun lien symbolique,
   <code class="literal">/./</code> ou <code class="literal">/../</code>. Les délimiteurs
   de fin comme <code class="literal">\</code> et <code class="literal">/</code> sont également supprimés.
  </p>
  <p class="para">
   <span class="function"><strong>realpath()</strong></span> retourne <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> si une erreur survient, p. ex.
   si le fichier n&#039;existe pas.
  </p>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    Le script qui s&#039;exécute doit avoir les permissions en exécution
    sur tous les dossiers de la structure, sinon, la fonction
    <span class="function"><strong>realpath()</strong></span> retourne <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>.
   </p>
  </p></blockquote>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    Pour les systèmes de fichiers insensibles à la casse,
    <span class="function"><strong>realpath()</strong></span> peut ou non normaliser la casse des
    caractères.
   </p>
  </p></blockquote>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    La fonction <span class="function"><strong>realpath()</strong></span> ne fonctionnera pas pour un 
    fichier qui se trouve à l&#039;intérieur d&#039;un phar car ce chemin serait un 
    chemin d&#039;accès virtuel, pas un vrai.
   </p>
  </p></blockquote>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    Sur Windows, les jonctions et les liens symboliques aux dossiers sont
    uniquement étendus d&#039;un niveau.
   </p>
  </p></blockquote>
  <blockquote class="note"><p><strong class="note">Note</strong>: <span class="simpara">
    Comme le type entier de PHP est signé et que de nombreuses plates-formes
    utilisent des entiers de 32 bits, certaines fonctions relatives au système
    de fichiers peuvent retourner des résultats étranges pour les fichiers de
    taille supérieure à 2 Go.
</span></p></blockquote>
 </div>


 <div class="refsect1 examples" id="refsect1-function.realpath-examples">
  <h3 class="title">Exemples</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Exemple #1 Exemple avec <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 />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>L&#039;exemple ci-dessus va afficher :</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>Exemple #2 Exemple avec <span class="function"><strong>realpath()</strong></span> sous Windows</strong></p>
    <div class="example-contents"><p>
     Sous Windows, <span class="function"><strong>realpath()</strong></span> changera les chemins de style Unix
     en chemins de style Windows.
    </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>L&#039;exemple ci-dessus va afficher :</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">Voir aussi</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.basename.php" class="function" rel="rdfs-seeAlso">basename()</a> - Retourne le nom de la composante finale d'un chemin</span></li>
    <li><span class="function"><a href="function.dirname.php" class="function" rel="rdfs-seeAlso">dirname()</a> - Renvoie le chemin du dossier parent</span></li>
    <li><span class="function"><a href="function.pathinfo.php" class="function" rel="rdfs-seeAlso">pathinfo()</a> - Retourne des informations sur un chemin syst&egrave;me</span></li>
   </ul>
  </p>
 </div>


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