I'm trying out zend expressive and this is my config/autoload/zend-expressive.global.php
and when I tried to do a request to a path which will go to an action class it returned the error page but I can't see any php error in the apache error log. So I can't tell what's the issue.
Is there a way in zend-expressive to have those php error log? Also any good documentation for zend expressive? It seems the official documentation doesn't really have much examples.
return [
'debug' => true,
'config_cache_enabled' => false,
'zend-expressive' => [
'error_handler' => [
'template_404' => 'error::404',
'template_error' => 'error::error',
],
],
];
If you want to try expressive I suggest to use the skeleton installer. It gives you options on what to install. One of the options is the whoops error handler which gives a lot of detailed info about exceptions.
The official docs are here with a lot of info: https://docs.zendframework.com/zend-expressive/
The installer docs: https://docs.zendframework.com/zend-expressive/getting-started/skeleton/
Update: Add ErrorHandler logger example
As a base for your ErrorHandler you can use
Zend\Stratigility\Middleware\ErrorHandler
. You can attach a listener to that ErrorHandler and use it for logging. Alternatively you can copy that class and modify it to your needs.Next step is creating a ErrorHandlerFactory for it:
After that you need to register the ErrorHandler. You do this by adding it to
config/autoload/middleware-pipeline.global.php
and specifically in themiddleware => always
section. This way it will always run. If you register it as first, it will run before anything else.