25

I've been using Zend Framework and just living with this problem for a while, but it's now just gotten too annoying so i'll send the question out to you.

There are certain problems within the Zend framework that Zend can recognize (such as calling a nonexistent controller), and will send that problem to the ErrorController. I've got that working fine.

There seem to be some problems that Zend Framework will fail and display the error through php, like if a certain function doesn't exist or something. Those I can see and fix.

Sometimes though, Zend won't fail, but it will also just send out an empty response. I will get a blank page. They layout doesn't show up, there's no code, there's no nothing to give me an idea of what's gone wrong. Last time, there was a require() that failed. I had to manually figure this out with no feedback.

Have any of you experienced this? Do you have any advice on how to get these errors to show? Any help would be appreciated!

9 Answers 9

32

The internal error handling of the framework's MVC components can only trap Exceptions, not PHP errors.

To assist in debugging during development, you can use the standard:

error_reporting(E_ALL|E_STRICT);
ini_set('display_errors', 'on');

Also, if you're using the new Autoloader included with 1.8, use:

Zend_Loader_Autoloader::getInstance()->suppressNotFoundWarnings(false);

To allow failed include/require statements to be issued.

Sign up to request clarification or add additional context in comments.

2 Comments

It was the suppressNotFoundWarnings that I'd missed. Thank you so much! You have no idea how much time this saves me.
That's strange because the manual says ZF doesn't do error suppression by default: framework.zend.com/manual/1.12/en/zend.loader.autoloader.html
13

Set this in your config:

phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1

2 Comments

Inside what config file?
Edit in => application/configs/config.php
12

For others coming across this question: I changed the following line in configs/application.ini

resources.frontController.params.displayExceptions = 0

To:

resources.frontController.params.displayExceptions = 1

This allowed me to see the full Exception, including stacktrace.

Comments

8

Edit the file public/index.php.
Change the APPLICATION_ENV to 'development'.

This will use the development settings in your application/configs/application.ini file. Those settings define whether to suppress errors.

Comments

7

It's too late to answer this question now. But hope it will help someone else...

Just place the following function in your Bootstrap.php file to enable exceptions..

protected function _initErrorDisplay(){
        $frontController = Zend_Controller_Front::getInstance();
        $frontController->throwExceptions(true);
    }

1 Comment

May I ask, what you mean with your enable ? Is it logging the exception that was not logged before ? Or is it displaying the exception in the application view ?
1

Open urproject/application/config and open application.ini
Change the second line:

phpSettings.display_errors = 0 

to

phpSettings.display_errors = 1

Now it will display errors.

Comments

1

Fast and dirty decision, if none of already mentioned methods worked (useful for old or ugly-configured version of ZF):

  • find ErrorController of your application.
  • put the call of debug_print_backtrace function at the top of init method (with die() optionally)

Comments

0

For anybody for whom the answers given here didn't work, one can always go to the apache logs to see a description of the problem. It would of course be more convenient if this showed on the page, but I find it to be an acceptable alternative.

 /var/log/apache2/error.log

I have this file open with vim and type :e to refresh and G to go to the bottom of the page to see the most recent error when I get the blank page. It tells you the time the error occurred, the message and the line, so it's pretty helpful.

Comments

0

put these lines in application/configs/config.php

error_reporting(E_ALL|E_STRICT);
ini_set('display_errors', 'on');

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.