title: PHP/Zend: Fatal error - Class not found
body: <p>I have a Zend project with the following directory structure:</p>
  
  <pre><code>/myApp
    /application
      Bootstrap.php
      /configs
        application.ini
      /layouts
      /modules
        /default
          /controllers
            MessageController.php
            ErrorController.php
            IndexController.php
          /models
            /DbTable
              Message.php
            Message.php
            MessageMapper.php
          /views
          Bootstrap.php
        /login
          /controllers
          /forms
          /library/login
          /models
          /plugins
          /views
          Bootstrap.php
    /data/db
    /library/zend
    /public
  </code></pre>
  
  <p><a href="http://localhost/" rel="nofollow">http://localhost/</a> - works fine but i can not get the login module and the message inside the Default module to work. I get the following error:</p>
  
  <p>
  Fatal error: Class 'Application_Module_Default_Model_MessageMapper' not found in /Library/WebServer/Documents/myApp/application/modules/default/controllers/MessageController.php on line 14</p>
  
  <p>I am sure i am not initialising something i need to. Here is what my code looks like..</p>
  
  <p>application.ini</p>
  
  <pre><code>autoloaderNamespaces[] ="Message_"
  autoloaderNamespaces[] ="Login_"
  autoloadernamespaces.0 = "Zend_"
  resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
  resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
  resources.frontController.moduleControllerDirectoryName = "controllers"
  resources.frontController.defaultControllerName = "index"
  resources.frontController.defaultActionName = "index"
  resources.frontController.params.displayExceptions = 0
  resources.frontController.defaultModule = "default"
  resources.frontController.params.prefixDefaultModule = "1"
  resources.frontController.plugins[] = "Login_Plugin_SecurityCheck"
  resources.modules = ""
  </code></pre>
  
  <p>/application/bootstrap.php</p>
  
  <pre><code>class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
  {
      protected function _initDoctype()
    {
      $this-&gt;bootstrap('view');
      $view = $this-&gt;getResource('view');
      $view-&gt;doctype('HTML5');
    }
  }
  </code></pre>
  
  <p>/public/index.php</p>
  
  <pre><code>set_include_path(implode(PATH_SEPARATOR, array(
  realpath(APPLICATION_PATH . '/../library'),
  get_include_path(),
  )));
  
  require_once 'Zend/Application.php';
  require_once('Zend/Loader/Autoloader.php');
  $autoloader = Zend_Loader_Autoloader::getInstance();
  </code></pre>
  
  <p>/module/default/controllers/MessageController.php</p>
  
  <pre><code>$message = new Application_Module_Default_Model_MessageMapper();
  $this-&gt;view-&gt;entries = $message-&gt;fetchAll();
  </code></pre>
  
  <p>Let me know if any more details would help. Any help would be much appreciated.</p>