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

  • Home
  • SEARCH
  • 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
Our ASP.NET 2 web application handles exceptions very elegantly. We catch exceptions in Global
Is there any way to handle all Errors Exceptions and crashes in WPF application?
I have a small utility application that handles sockets, both TCP and UDP. Occasionally,
From a security standpoint, what is the best solution to handle application errors with
In my web application, I handle errors with annotations. Everything works fine and I
I have a application which handles picture chosen from gallery. But there is a
I've been developing an application that handles accounts and transactions made over these accounts.
I have an Email-listening application that handles incoming mails, depending on the Bucket (or
I have a ASP.NET MVC3 application that handles time-consuming processes (copying a large file

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.