title: Best method for creating absolute path in PHP? (See 3 methods listed inside)
body: <p>I can create paths with no problem, but I want to know which of these 3 methods is the most rock solid and reliable and will work on the most servers.  </p>
  
  <p>Right now I am using method 1 in my script and some users are having path issues. I just want the method that will work on any version of php and almost any server config.  </p>
  
  <pre><code>1.  &lt;?php echo $_SERVER['DOCUMENT_ROOT']; ?&gt;
  
  2.  &lt;?php echo getcwd(); ?&gt;
  
  3.  &lt;?php echo dirname(__FILE__); ?&gt;
  </code></pre>
  
  <p>Thank you so much for any expertise you can provide about this!</p>