title: require_once failed to open stream: No such file or directory
body: <p>The required library class seems to elude two .php files though it is found for the other one. The class (libraries/Database.php) methods are used in footer.php.</p>
  <p>The error I receive is this:</p>
  <blockquote>
  <p>Warning: require_once(libraries/Database.php): failed to open stream: No such file or directory in D:\PHP\Projects in PHP and MySQL\talkingspace\core\init.php on line 15</p>
  <p>Fatal error: require_once(): Failed opening required 'libraries/Database.php' (include_path='C:\xampp\php\PEAR') in D:\PHP\Projects in PHP and MySQL\talkingspace\core\init.php on line 15</p>
  </blockquote>
  <p>init.php:</p>
  <pre><code>&lt;?php
  // start session since we use it on every page
  session_start();
  
  // config file
  require_once('config/config.php');
  
  // helper functions
  require_once('helpers/db_helper.php');
  require_once('helpers/format_helper.php');
  require_once('helpers/system_helper.php');
  
  // for autoload of classes
  function __autoload($class_name) {
      require_once('libraries/'.$class_name.'.php');
  }
  </code></pre>
  <p>The index.php file displays correctly:</p>
  <pre><code>&lt;?php require('core/init.php'); ?&gt;
  &lt;?php
  // create Topic object
  $topic = new Topic();
  // get Template class
  $template = new Template('templates/frontpage.php');
  // assign vars
  $template -&gt; topics = $topic -&gt; getAllTopics();
  $template -&gt; totalTopics = $topic -&gt; getTotalTopics();
  $template -&gt; totalCategories = $topic -&gt; getTotalCategories();
  // display template
  echo $template;     
  </code></pre>
  <p>Its template file</p>
  <pre><code>&lt;?php include 'includes/header.php'; ?&gt;                         
  &lt;ul id=&quot;topics&quot;&gt;
  &lt;?php if ($topics) : ?&gt;
  &lt;?php foreach($topics as $topic) : ?&gt;
      &lt;li class=&quot;topic&quot;&gt;
          &lt;div class=&quot;row&quot;&gt;
              &lt;div class=&quot;col-md-2&quot;&gt;
                  &lt;img class=&quot;avatar pull-left&quot; src=&quot;images/avatars/&lt;?php echo $topic -&gt; avatar; ?&gt;&quot; /&gt;
              &lt;/div&gt;
              &lt;div class=&quot;col-md-10&quot;&gt;
                  &lt;div class=&quot;topic-content pull-right&quot;&gt;
                      &lt;h3&gt;&lt;a href=&quot;topic.html&quot;&gt;&lt;?php echo $topic -&gt; title; ?&gt;&lt;/a&gt;&lt;/h3&gt;
                      &lt;div class=&quot;topic-info&quot;&gt;
                          &lt;a href=&quot;topics.php?category=&lt;?php echo urlFormat($topic -&gt; category_id); ?&gt;&quot;&gt;&lt;?php echo $topic -&gt; name; ?&gt;&lt;/a&gt; &gt;&gt; &lt;a href=&quot;topics.php?user=&lt;?php echo urlFormat($topic -&gt; user_id) ?&gt;&quot;&gt;&lt;?php echo $topic -&gt; username; ?&gt;&lt;/a&gt; &gt;&gt; Posted on: &lt;?php echo formatDate($topic -&gt; create_date); ?&gt; 
                          &lt;span class=&quot;badge pull-right&quot;&gt;&lt;?php echo replyCount($topic -&gt; id); ?&gt;&lt;/span&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/li&gt;
  &lt;?php endforeach; ?&gt;
  &lt;/ul&gt;
  &lt;?php else : ?&gt;
      &lt;p&gt;No topics to display&lt;/p&gt;
  &lt;?php endif; ?&gt;
  &lt;h3&gt;Forum Statistics&lt;/h3&gt;
  &lt;ul&gt;
      &lt;li&gt;Total Number of Users: &lt;strong&gt;52&lt;/strong&gt;&lt;/li&gt;
      &lt;li&gt;Total Number of Topics: &lt;strong&gt;&lt;?php echo $totalTopics; ?&gt;&lt;/strong&gt;&lt;/li&gt;
      &lt;li&gt;Total Number of Categories: &lt;strong&gt;&lt;?php echo $totalCategories; ?&gt;&lt;/strong&gt;&lt;/li&gt;
  &lt;/ul&gt;
  &lt;?php include 'includes/footer.php'; ?&gt;
  </code></pre>
  <p>serves well however a similar template file fails with two other .php files. Here's one (register.php):</p>
  <pre><code>&lt;?php require('core/init.php'); ?&gt;
  &lt;?php
  // get Template class
  $template = new Template('templates/register.php');
  // assign vars
  $template -&gt; title = 'Create an Account';
  // display template
  echo $template;
  </code></pre>
  <p>and its template is:</p>
  <pre><code>&lt;?php include 'includes/header.php'; ?&gt;
      &lt;form role=&quot;form&quot; enctype=&quot;multipart/form-data&quot; method=&quot;post&quot; action=&quot;register.php&quot;&gt;
          &lt;div class=&quot;form-group&quot;&gt;
              &lt;label&gt;Name&lt;sup&gt;*&lt;/sup&gt;&lt;/label&gt;
              &lt;input type=&quot;text&quot; class=&quot;form-control&quot; name=&quot;name&quot; placeholder=&quot;Enter Your Name&quot;&gt;
          &lt;/div&gt;
          &lt;div class=&quot;form-group&quot;&gt;
              &lt;label&gt;Email Address&lt;sup&gt;*&lt;/sup&gt;&lt;/label&gt;
              &lt;input type=&quot;email&quot; class=&quot;form-control&quot; name=&quot;email&quot; placeholder=&quot;Enter Your Email Address&quot;&gt;
          &lt;/div&gt;
          &lt;div class=&quot;form-group&quot;&gt;
              &lt;label&gt;Choose Username&lt;sup&gt;*&lt;/sup&gt;&lt;/label&gt;
              &lt;input type=&quot;text&quot; class=&quot;form-control&quot; name=&quot;username&quot; placeholder=&quot;Create A Username&quot;&gt;
          &lt;/div&gt;
          &lt;div class=&quot;form-group&quot;&gt;
              &lt;label&gt;Password&lt;sup&gt;*&lt;/sup&gt;&lt;/label&gt;
              &lt;input type=&quot;password&quot; class=&quot;form-control&quot; name=&quot;password&quot; placeholder=&quot;Enter A Password&quot;&gt;
          &lt;/div&gt;
          &lt;div class=&quot;form-group&quot;&gt;
              &lt;label&gt;Confirm Password&lt;sup&gt;*&lt;/sup&gt;&lt;/label&gt;
              &lt;input type=&quot;password&quot; class=&quot;form-control&quot; name=&quot;password2&quot; placeholder=&quot;Enter Password Again&quot;&gt;
          &lt;/div&gt;
          &lt;div class=&quot;form-group&quot;&gt;
              &lt;label&gt;Upload Avatar&lt;/label&gt;
              &lt;input type=&quot;file&quot; name=&quot;avatar&quot;&gt;
              &lt;p class=&quot;help-block&quot;&gt;&lt;/p&gt;
          &lt;/div&gt;
          &lt;div class=&quot;form-group&quot;&gt;
              &lt;label&gt;About Me&lt;/label&gt;
              &lt;textarea id=&quot;about&quot; rows=&quot;6&quot; cols=&quot;80&quot; class=&quot;form-control&quot; name=&quot;about&quot; placeholder=&quot;Tell us about yourself (Optional)&quot;&gt;&lt;/textarea&gt;
          &lt;/div&gt;
          &lt;input name=&quot;register&quot; type=&quot;submit&quot; class=&quot;btn btn-default&quot; value=&quot;Register&quot; /&gt;
      &lt;/form&gt;
  &lt;?php include 'includes/footer.php'; ?&gt;
  </code></pre>
  <p>Please assist. I tried a few solutions posted here to no avail. The XAMPP folder is the default one on C:\ and the project folder is on another drive.</p>