title: PHP file_exists will not work
body: <p>I have been having problems with <code>file_exists</code> function in PHP that it always returns false, though the file is there as I can remove the if statement and it shows up fine.</p>
  
  <pre><code>$filename = $_SERVER['DOCUMENT_ROOT']."/images/profilepictures/1.png";
  if (file_exists($filename) == true)
  {
      $output .= '&lt;img src="'.$filename.'" alt="profile picture" width="200"/&gt;';
  }
  </code></pre>
  
  <p>The <code>$filename</code> echos as:</p>
  
  <pre><code>/home/content/k/e/r/kernelkev/html/images/profilepictures/1.png
  </code></pre>
  
  <p>I have been googling this and most answers are to use the DOCUMENT_ROOT, but it still does not work for me.</p>
  
  <p>Could anyone shed some light on this as it is really annoying me now.</p>
  
  <hr>
  
  <p>This seemed to fix it... </p>
  
  <pre><code>$filename = "/images/profilepictures/1.png";
  if (file_exists("..".$filename))
  {
      $output .= '&lt;img src="'.$filename.'" alt="profile picture" width="150"/&gt;';
  }
  </code></pre>
  
  <p>I have no idea why, but there we go.</p>