title: Cannot include file and got "failed to open stream: No such file or directory" warning message
body: <p>I got the following error when a file is included.</p>
  
  <pre><code> Warning:  require(home2/myusername/public_html/inc/config.php) 
   [function.require]: failed to open stream: No such file or directory in 
   /home2/myusername/public_html/inc/bootstrap.php on line 32
  
   Fatal error:  require() [function.require]: Failed opening required 
   'home2/myusername/public_html/inc/config.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in 
   /home2/myusername/public_html/inc/bootstrap.php on line 32
  </code></pre>
  
  <p>It is working fine in my localhost running on Windows PC. But I got that error when I uploaded the files on my shared hosting server which is CentOS.</p>
  
  <p><code>home2/myusername/public_html/index.php</code> includes <code>/inc/bootstrap.php</code> which is then trying to include <code>/inc/config.php</code>. The file <code>config.php</code> does exist on the server. <code>home2/myusername/public_html/</code> is returned by the function <code>getcwd()</code>.</p>
  
  <p>The below is the first few lines of codes in bootstrap.php which issues the error.</p>
  
  <pre><code>define('APP_DIR', 'app');   
  
  if( !defined('APP_ROOT') ){
      $APP_ROOT = trim(getcwd(), '/').'/';
      if(isset($_GET['bootstrap'])) $APP_ROOT .= APP_DIR . '/';
      define('APP_ROOT', $APP_ROOT);
  }
  
  if( !defined('ROOT') ){
      $ROOT = str_replace(APP_DIR, '', trim(APP_ROOT, '/'));
      if( strrpos($ROOT, '/') != strlen($ROOT)-1 ) $ROOT .= '/'; 
      define('ROOT', $ROOT);
  }
  
  # path to inc/ folder
  define('INC', ROOT.'inc/');
  
  # System configuration variables
  require INC . 'config.php';
  </code></pre>
  
  <p>I have also a URL Rewrite in <code>/public_html/.htaccess</code>.</p>
  
  <pre><code>RewriteRule ^index.php$ index.php?bootstrap [L]
  </code></pre>
  
  <p>So, when I browse <code>example.com/index.php</code>, it rewrites to <code>example.com/index.php?bootstrap</code>. It is the situation I got the error. </p>
  
  <p>Here is my directory structure:</p>
  
  <pre><code>/public_html/
      |__ inc
      |   |__ bootstrap.php
      |   |__ config.php
      |__ .htaccess
      |__ index.php &lt;--- I'm browsing this    
  </code></pre>
  
  <p>I think the problem would be related to the absolute path file include. The relative path file include <code>require 'inc/bootstrap.php</code> in index.php is okay.</p>