Hi,
Not long ago I noticed that my app doesn't log fatal errors properly because sometihng went wrong. It seemed like fatal error(wrong parsing) caused error controller not to boot up so I replaced order of few booting methods an stuff worked.
But the thing is that it works only on apache and nginx still produces default 500 error. I've edited php-fpm and nginx configs, added various flags but still no luck.
It crashes whern I try to call distpatch function in my errors distpacher and php error output is:
Phalcon\Mvc\Dispatcher->_throwDispatchException
Entire error for this event looks like this:
2016/03/02 12:09:20 [error] 1973#0: *1 FastCGI sent in stderr: "PHP message: PHP Fatal error: Call to a member function format() on boolean in /www/web/public/app/Web/Controller/TestController.php on line 59
PHP message: PHP Stack trace:
PHP message: PHP 1. {main}() /www/web/public/public/index.php:0
PHP message: PHP 2. Phalcon\Mvc\Application->handle() /www/web/public/public/index.php:10
PHP message: PHP 3. Phalcon\Dispatcher->dispatch() /www/web/public/public/index.php:10
PHP message: PHP 4. MyApp\Web\Controller\TestController->fatalAction() /www/web/public/public/index.php:10
PHP message: PHP Fatal error: Uncaught exception 'Phalcon\Mvc\Dispatcher\Exception' with message 'MyApp\Web\Controller\ErrorController handler class cannot be loaded' in /www/web/public/app/Application.php:363
Stack trace:
0 [internal function]: Phalcon\Mvc\Dispatcher->_throwDispatchException('MyApp\\Web\\Con...', 2)
1 /www/web/public/app/Application.php(363): Phalcon\Dispatcher->dispatch()
2 /www/web/public/app/Application.php(102): MyApp\Application->handleError(Array)
3 [internal function]: MyApp\Application->MyApp\{closure}()
4 {main}
thrown in /www/web/public/app/Application.php on line 363
PHP message: PHP Stack trace:
PHP message: PHP 1. {main}() /www/web/public/public/index.php:0
PHP message: PHP 2. Phalcon\Mvc\Application->handle() /www/web/public/public/index.php:10
PHP message: PHP 3. Phalcon\Dispatcher->dispatch() /www/web/public/public/index.php:10
PHP message: PHP 4. MyApp\Web\Controller\TestController->fatalAction() /www/web/public/public/index.php:10" while reading response header from upstream, client: 192.168.30.1, server: app.loc, request: "GET /test/fatal HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "app.loc"
Has anyone encountered this kind of problem where fatal error on (nginx + php-fpm) caused you application to crash without calling some kind of error controller or some other logging mechanism? And how you solved that issue?
P.S I know i can try cactch and write it to log by brue force it but I really want to understand why this happend and why apache behaves diferently from nginx when handling fatal errors in this case.