title: PHP file_exists returns false but the file does exist
body: <p>I have seen several similar questions, but no answer worked in my situation, except that it probably has something to do with permissions.</p>
  
  <p>A PHP script served by Apache tells me <code>unable to open database file</code>.</p>
  
  <p>When I print the path to that file, it returns a valid path, say DBPATH. The file does exist at that location; I gave it and its parent folder <code>777</code> rights; I gave them <code>user:user</code> access, where <code>user</code> is the sudoer that all script files belong to. I did the same to the whole <code>htdocs/</code> folder, just in case.</p>
  
  <p>When I print <code>file_exists(DBPATH)</code>, it returns false. Is is most likely a matter of permissions, but I don't know what I should change for PHP to have access rights. I tried <code>apache:apache</code>, too. I cannot <code>su apache</code> (user not available).</p>
  
  <p>My scripts are in <code>htdocs/</code>. <strong>DBFILE</strong> is somewhere out of it (I tried <code>/tmp/test</code>, all in <code>777</code>, but no luck either).</p>
  
  <p>No safe_mode, PHP 5.4 freshly installed, CentOS7.</p>
  
  <p>Please someone give me a clue at least to help debug it. 
  Maybe such as: how can I check whether my file will be readable from apache/my php script, without running the script itself? How can I get the name of the user that is used to execute it?</p>