title: Why do I get "Warning: require_once(config): failed to open stream: No such file or directory" when trying to run this code?
body: <p>I'm currently working on programming my very own online store with <code>NetBeans IDE 8.0.2</code> using <code>PHP</code>. My system is Windows 7 32bit and my localhost is powered by WampServer 2.5. I'm following THC Courses: <a href="https://www.youtube.com/playlist?list=PLbXVpMmmrntAvOYgkqhHW0hVu8dWUNyfz" rel="nofollow">https://www.youtube.com/playlist?list=PLbXVpMmmrntAvOYgkqhHW0hVu8dWUNyfz</a></p>
  
  <p>So far everything was going great but I got stock at this video: S2 {Building Framework} Class and method (p6). The guy is asking to echo a sample text on the screen to test the code, but I get these two error messages when running the project on localhost:</p>
  
  <blockquote>
    <p>Warning: require_once(config): failed to open stream: No such file or directory in C:\wamp\www\ecommerce\inc\autoload.php on line 2<br />
    Fatal error: require_once(): Failed opening required 'config' (include_path='.;C:\php\pear') in C:\wamp\www\ecommerce\inc\autoload.php on line 2   </p>
  </blockquote>
  
  <p>autoload.php:</p>
  
  <pre><code>&lt;?php
  
      require_once('config');
  
      function __autoload($class_name) {
  
          $class = explode("_", $class_name);
          $path = implode("/", $class).".php";
          require_once($path);
  
      }
  </code></pre>
  
  <p>Core.php:</p>
  
  <pre><code>&lt;?php
  
      class Core {
  
          public function run() {
              echo "Hello this is a print test";
  
          }
  
      }
  </code></pre>
  
  <p>index.php:</p>
  
  <pre><code>&lt;?php
  
      require_once'inc/autoload.php';
      $core = new Core();
      $core-&gt;run();
  </code></pre>
  
  <p>config.php:</p>
  
  <pre><code>&lt;?php
  
      if(!isset($_SESSION)) {
          session_start();
  
      }
  
      //site domain name with http
      defined("SITE_URL")
      ||define("SITE_URL", "http://".$_SERVER['SERVER_NAME']);
  
      //directory seperator
      defined("DS")
      ||define("DS", DIRECTORY_SEPERATOR);
  
      //root path
      defined("ROOT_PATH")
      ||define("ROOT_PATH", realpath(dirname(__FILE__) .DS.".." .DS));
  
  
      //classes folder
      defined("CLASSES_DIR")
      ||define("CLASSES_DIR", classes);
  
      //pages folder
      defined("PAGES_DIR")
      ||define("PAGES_DIR", pages);
  
  
  
      //modules folder
      defined("MOD_DIR")
      ||define("MOD_DIR", "mod");
  
  
      //inc folder
      defined("INC_DIR")
      ||define("INC_DIR", "inc");
  
  
      //templates folder
      defined("TEMPLATE_DIR")
      ||define("TEMPLATE_DIR", "template");
  
      //emails path
      defined("EMAILS_PATH")
      ||define("EMAILS_PATH", ROOTH_PATH.DS. "emails");
  
      //catalogue images path
      defined("CATALOGUE_PATH")
      ||define("CATALOGUE_PATH", ROOTH_PATH.DS. "media" .DS."catalogue");
  
  
      //add all above directories to the include path
      set_include_path(implode(PATH_SEPERATOR, array(
      realpath(ROOTH_PATH.DS.CLASSES_DIR),
      realpath(ROOTH_PATH.DS.PAGES_DIR),
      realpath(ROOTH_PATH.DS.MOD_DIR),
      realpath(ROOTH_PATH.DS.INC_DIR),
      realpath(ROOTH_PATH.DS.TEMPLATE_DIR).
      get_include_path()
  
      )));
  </code></pre>