title: PHP get absolute path without following symlinks
body: <p>How do I get the absolute path to a file, without following symlinks.</p>
  
  <p>E.g.</p>
  
  <pre><code>/path/to/some/file
  /path/to/some/link -&gt; /path/to/some/file
  /path/to/some/directory/
  </code></pre>
  
  <p>My current working directory is <code>/path/to/some/directory/</code> and I go <code>realpath('../link)</code> it returns <code>/path/to/some/file</code>.</p>
  
  <p><em>(I know <code>realpath</code> is supposed to work this way)</em></p>
  
  <p>Is there a function instead of <code>realpath</code> that would return <code>/path/to/some/link</code></p>