title: php file_exists is returning false even if file exist on my linux
body: <p>This question has been asked many times, but none of the answers I found helped me. </p>
  
  <p>I am trying to get php file_exists() to work. The only scenario when it works is when the php-file is in the same directory as the file to use file_exist() on and only using the file name (i.e. excluding the path). But it's not consequent behaviour, please see below. </p>
  
  <p>Som information: </p>
  
  <ul>
  <li>safe_mode=off </li>
  <li>no symlinks for directory 28</li>
  <li>no whitespace in the file name</li>
  <li>All directories in /var/www/html/smic/upload/28/ has apache:apache 777 as permission. </li>
  <li>Using php 5.3</li>
  </ul>
  
  <p>PHP: </p>
  
  <pre><code>echo getcwd()
  clearstatcache();
  $file = 'file:///var/www/html/smic/upload/28/ul.txt';
  //Also tried like this
  //$file = '/var/www/html/smic/upload/28/ul.txt';
  
  if(file_exists($file)){
      echo $file." exists";
  }
  </code></pre>
  
  <p>getcwd() prints /var/www/html/smic/modules/core/ticket</p>
  
  <p>The permission of the php-script and the file to be checked is apache:apache 777.</p>
  
  <p>Some details about the directory structure: </p>
  
  <pre><code>[root@localhost 28]# pwd
  /var/www/html/smic/upload/28
  
  [root@localhost 28]# ls -l ul.txt
  -rw-r--r--. 1 apache apache 2 Feb  9 10:50 ul.txt
  
  [root@localhost 28]# chmod 777 ul.txt
  
  [root@localhost 28]# ls -l ul.txt
  -rwxrwxrwx. 1 apache apache 2 Feb  9 10:50 ul.txt
  </code></pre>
  
  <p>The behaviour didn't change after changing the permission of the file. The directory /28 has drwxr-xr-x. for apache user and apache group </p>
  
  <p>For test, I also moved the actual php-script to /28, gave it apache:apache 777 rigths. Changed the $file to "ul.txt" (i.e. $file = 'ul.txt';). That works, the ul.txt file is found. </p>
  
  <p>getcwd() prints then /var/www/html/smic/upload/28</p>
  
  <p>As another test I tried to find another file excluding the path in the "ticket" directory, the file wasn't recognized. </p>
  
  <p>I'm banging my head...</p>
  
  <p>Any advice is appreciated. </p>