[ACCEPTED]-Display php errors when using Zend framework-zend-framework

Accepted answer
Score: 32

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

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

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

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

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

To allow failed include/require 1 statements to be issued.

Score: 12

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

resources.frontController.params.displayExceptions = 0

To:

resources.frontController.params.displayExceptions = 1

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

Score: 12

Set this in your config:

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

0

Score: 8

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

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

Score: 6

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

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

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

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

phpSettings.display_errors = 0 

to

phpSettings.display_errors = 1

Now it will display 1 errors.

Score: 1

Fast and dirty decision, if none of already 2 mentioned methods worked (useful for old 1 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)
Score: 0

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

 /var/log/apache2/error.log

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

Score: 0

put these lines in application/configs/config.php

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

0

More Related questions