Hiding error details on production in ZF2


Unlike ZF1, Zend Framework 2 doesn't have a built-in concept of "production" or "development" environments, so by default, the error pages (which include a full stack trace) will appear on your production servers as well as your development environments. This isn't really desirable, but it is easy to change. The local.php config files are excluded from source control, and so are the place for environment-specific configuration.

To hide the error details, edit config/autoload/local.php on your production server and add (to the existing array defined in that file):

'view_manager' => array(
    'display_exceptions' => false

And that will hide your error details on your production server only.

Comments (2) Tags: zend framework


30th Jan, 2017

Just saved my life . Thanks


30th May, 2017


That was a great help.


Add Comment

(Never shown on the site)

(Newlines preserved, format with Markdown)