title: PHP class - error in linux but works in windows
body: <p>I've created a class and defined its namespace and am calling it in the index using <code>use</code> followed by its namespace,besides, i've created autoloader file. it runs on windows all goes smoothly, but if in linux I get an error message</p>
  
  <blockquote>
    <p>Fatal Error: Uncaught Error: Class' lib \ MVC \ Router 'not found in /opt/lampp/htdocs/pos-hm-git/index.php:6 Trace trail: # 0 {main} thrown into /opt/lampp/htdocs/pos-hm-git/index.php on line 6</p>
  </blockquote>
  
  <p><a href="https://i.stack.imgur.com/6OCJd.png" rel="nofollow noreferrer">Structure Folder</a> </p>
  
  <p><strong>index.php</strong></p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;?php
  require_once __DIR__ . '/autoloader.php';
  
  use lib\MVC\Router;
  
  $kernel = new  Router($_GET);
  $controller = $kernel-&gt;getController();
  $controller-&gt;executeAction();
   ?&gt;
  </code></pre>
  
  
  
  <p><strong>autoloader.php</strong></p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;?php
  
  spl_autoload_extensions(".php");
  spl_autoload_register();
  ?&gt;
  </code></pre>
  
  
  
  <p><strong>Router.php</strong></p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;?php
  namespace lib\MVC;
  
  class Router
  {
    private $controller;
    private $action;
    private $urlparams;
    private $controller_namespace = "\\Controllers\\";
    private $base_controller_name = "lib\\MVC\\BaseController";
  
    function __construct($url)
    {
      //memasukan semua parameter dari index yang di tangkap dengan GET
      $this-&gt;urlparams = $url;
      //menentukan nama controller
      if (empty($this-&gt;urlparams['controller'])) {
          $this-&gt;controller = $this-&gt;controller_namespace . "Home";
      }else {
          $this-&gt;controller = $this-&gt;controller_namespace . $this-&gt;urlparams['controller'];
      }
  
      //menentukan aksi yang akan dijalankan
      if (empty($this-&gt;urlparams['action'])) {
          $this-&gt;action = "index";
      }else {
          $this-&gt;action = $this-&gt;urlparams['action'];
      }
    }
  
    public function getController()
    {
      if (class_exists($this-&gt;controller)) {
          $parent = class_parents($this-&gt;controller);
  
          if (in_array($this-&gt;base_controller_name, $parent)) {
            if (method_exists($this-&gt;controller, $this-&gt;action)) {
  
              return new $this-&gt;controller($this-&gt;action, $this-&gt;urlparams);
  
            }else {
              throw new \Exception("Aksi tidak ditemukan, braaaaay", 1);
            }
          }else {
            throw new \Exception("class untuk controller salah braaay, coba sekali lagi", 1);
          }
      }else {
        throw new \Exception("Controller tidak ditemukan, braaay", 1);
      }
    }
  
  }
  
  
  ?&gt;
  </code></pre>