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 4260232
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T05:53:33+00:00 2026-05-21T05:53:33+00:00

One of my recent questions ( here ) asked about how to catch errors

  • 0

One of my recent questions (here) asked about how to catch errors (and display them with the ErrorController) in the Bootstrap file. The example I used was during database instantiation: if an error occurred in the Bootstrap, it would just dump the error onto the screen without calling the ErrorController.

But, say, in my database instantiation plugin, I have this code:

public function dispatchLoopStartup(Zend_Controller_Request_Abstract $request) {
    $db = Zend_DB::factory("Pdo_Mysql", $this->config);
    Zend_Registry::set("db", $db);
}

No error will be thrown, even if the database isn’t connected. This is because Zend_DB doesn’t bother to check that the database is live, so as to not waste resources and time.

My question is whether I should do something like this:

public function dispatchLoopStartup(Zend_Controller_Request_Abstract $request) {
    $db = Zend_DB::factory("Pdo_Mysql", $this->config);
    $db->getConnection();
    Zend_Registry::set("db", $db);
}

That way, any connectivity problems are caught early on and displayed. Is this a good idea? Should my application instead wait to check that the database connection is live on first usage?

  • 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-21T05:53:33+00:00Added an answer on May 21, 2026 at 5:53 am

    I would setup specific handling of the Zend_Db exception type in my error controller.

    PHP is not stateful, so initialization of the app is going to happen for every page request. What if my page request doesnt even need the DB (for example, my maintenance page, error pages, etc)?

    Most importantly, what is the proper handling of no connection during bootstrap? How can you be sure that any other resources you need in order to render an error page have finished bootstrapping?

    However, this is just my preference.

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

Sidebar

Related Questions

In one of my recent questions about using CreateDesktop() API call to create a
In a recent project, I built my own MVC framework in PHP. One of
One of those classic programming interview questions... You are given two marbles, and told
One of my biggest typographical frustrations about HTML is the way that it mangles
One of the things that has been talked about a few times on the
I recently asked a question about functional programming, and received (good!) answers that prompted
Looking at the related questions, I don't think this specific question has been asked,
A couple of recent questions discuss strategies for naming columns, and I was rather
Code: http://pastie.org/1961455 Trackback: Traceback (most recent call last): File C:\Users\COMPAQ\Desktop\NoughtsCrosses.py, line 149, in <module>
I want to display the most recent posts from my phpbb3 forum on my

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.