title: zend framework error controller not handling EXCEPTION_NO_CONTROLLER
body: <p>In my Zend Framework project, my Error controller is not handling EXCEPTION_NO_CONTROLLER exception. When I debug the Error controller, it does enter the EXCEPTION_NO_CONTROLLER switch block and goes through each and every step in the method but my error.phtml is not being rendered. It shows me the fatal error instead of error.phtml view. It handles the EXCEPTION_NO_ACTION and default block and renders the error.phtml view. I don't understand what the problem is or what I'm missing. </p>
  
  <p>Here is my error action in error controller code:</p>
  
  <pre><code> public function errorAction()
   {
      $errors = $this-&gt;_getParam('error_handler');
  
      if (!$errors) {
          $this-&gt;view-&gt;message = 'You have reached the error page';
          return;
      }
  
      switch ($errors-&gt;type) {
          case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ROUTE:
          case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
  
              // 404 error -- controller or action not found
              $this-&gt;getResponse()-&gt;setHttpResponseCode(404);
              $this-&gt;view-&gt;message = 'no such module exist';
              break;
          case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
  
              // 404 error -- controller or action not found
              $this-&gt;getResponse()-&gt;setHttpResponseCode(404);
              $this-&gt;view-&gt;message = 'no such module exist';
              break;
          default:
  
  
              $this-&gt;getResponse()-&gt;setHttpResponseCode(500);
              $this-&gt;view-&gt;message = 'an application error occurred';
              break;
      }
  
      // Log exception, if logger available
      //if ($log == $this-&gt;getLog()) {
      //    $log-&gt;crit($this-&gt;view-&gt;message, $errors-&gt;exception);
      //}
  
      // conditionally display exceptions
      if ($this-&gt;getInvokeArg('displayExceptions') == true) {
          $this-&gt;view-&gt;exception = $errors-&gt;exception;
      }
  
      $this-&gt;view-&gt;request   = $errors-&gt;request;
  }
  </code></pre>
  
  <p>And I receive the following fatal error when I type any invalid controller:</p>
  
  <pre><code>Fatal error: Uncaught exception 'Zend_View_Exception' with message 'script' not found in path .....................
  </code></pre>
  
  <p>Following is my index.php 
     
  
  <pre><code>// Define path to application directory
  defined('APPLICATION_PATH')
  || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
  
  // Define application environment
  defined('APPLICATION_ENV')
  || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV')     :   'development'));
  
  // Ensure library/ is on include_path
  set_include_path(implode(PATH_SEPARATOR, array(
  realpath(APPLICATION_PATH . '/../library'),
  get_include_path(),
  )));
  
  set_include_path(implode(PATH_SEPARATOR, array(
  '/home/sampleproj/www/library/',
      get_include_path(),
  )));
  
  
  /** Zend_Application */
  require_once 'Zend/Application.php';
  
  // Create application, bootstrap, and run
  $application = new Zend_Application(
  APPLICATION_ENV,
  APPLICATION_PATH . '/configs/application.ini'
  );
  $application-&gt;bootstrap()
          -&gt;run();
  </code></pre>