[ACCEPTED]-Display php errors when using Zend framework-zend-framework
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.
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.
Set this in your config:
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1
0
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.
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);
}
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.
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)
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.
put these lines in application/configs/config.php
error_reporting(E_ALL|E_STRICT);
ini_set('display_errors', 'on');
0
More Related questions
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.