Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 600625
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T16:37:33+00:00 2026-05-13T16:37:33+00:00

My application handles errors happily in development, both errors and exceptions. When I switch

  • 0

My application handles errors happily in development, both errors and exceptions. When I switch to production the application just returns a blank page as the config is set to not display errors. Is there a standard method in ZF for sending visitors to a nicely formatted ‘Page not found’ using a layout from the application so that they aren’t presented with a blank page. Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T16:37:33+00:00Added an answer on May 13, 2026 at 4:37 pm

    Usually if you used the CLI to create the zend project it will already be able to do what you request. If you go the scripts/view/errors/error.phtml that will be the phtml file you can use to create the view you are looking to use.

    Although if you did not use the CLI to create the zend project bellow is the generated ErrorController used

    <?php
    
    class ErrorController extends Nanaly_Controller
    {
    
        public function errorAction()
        {
            $errors = $this->_getParam('error_handler');
    
            switch ($errors->type) {
                case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ROUTE:
                case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
                case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
    
                    // 404 error -- controller or action not found
                    $this->getResponse()->setHttpResponseCode(404);
                    $this->view->message = 'Page not found';
                    break;
                default:
                    // application error
                    $this->getResponse()->setHttpResponseCode(500);
                    $this->view->message = 'Application error';
                    break;
            }
    
            // Log exception, if logger available
            if ($log = $this->getLog()) {
                $log->crit($this->view->message, $errors->exception);
            }
    
            // conditionally display exceptions
            if ($this->getInvokeArg('displayExceptions') == true) {
                $this->view->exception = $errors->exception;
            }
    
            $this->view->request   = $errors->request;
        }
    
        public function getLog()
        {
            $bootstrap = $this->getInvokeArg('bootstrap');
            if (!$bootstrap->hasPluginResource('Log')) {
                return false;
            }
            $log = $bootstrap->getResource('Log');
            return $log;
        }
    
    
    }
    

    Note: this Controller was generated using Zend Version 1.10.0

    and the view should be placed in the same location as stated earlier.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've written an application that handles most exceptions gracefully, with the page's design intact
At a new job I started, we have both a Java application that handles
Is there any way to handle all Errors Exceptions and crashes in WPF application?
My application correctly handles different kind of character sets, but only internally - when
What is the best way to determine how many window handles an application is
I have an iPhone application with a settings.bundle that handles various settings for my
Is it possible for a .NET application to grab all the window handles currently
Hi I have an MDI application where a child window handles a number of
This question is language independent. I have an application that handles requests in a
We have an MVC.NET application that encounters fatal errors when it restarts. In our

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.