Why is this fatal error printed on the page, despite the application being configured on "production" mode?

This question is not about why and how to fix this error, but why I’m getting it in production mode for symfony 3.4 ( error is imitated by me via changing MySQL host to wrong one )


Recently we updated from symfony 3.1 to 3.4 and today we noticed that our project throwing error on production environment

Fatal error: Uncaught PDOException: PDO::__construct(): php_network_getaddresses: getaddrinfo failed: No such host is known. in pathprojectvendordoctrinedballibDoctrineDBALDriverPDOConnection.php:27
Stack trace:

#0 pathprojectvendordoctrinedballibDoctrineDBALDriverPDOConnection.php(27): PDO->__construct(‘mysql:host=loca…’, ‘user’, ‘pass’, Array)

#1 pathprojectvendordoctrinedballibDoctrineDBALDriverPDOMySqlDriver.php(25): DoctrineDBALDriverPDOConnection->__construct(‘mysql:host=loca…’, ‘user’, ‘pass’, Array)

#2 pathprojectvendordoctrinedballibDoctrineDBALConnection.php(356): DoctrineDBALDriverPDOMySqlDriver->connect(Array, ‘user’, ‘pass’, Array)

#3 pathprojectvendordoctrinedoctrine-bundleConnectionFactory.php on line 79

Weird is as you can see in screenshot it as no symfony error page design but just pure error message

enter image description here

but we are using app.php where AppKernel(‘prod’, false);

$loader = require __DIR__.'/../app/autoload.php';
include_once __DIR__.'/../var/bootstrap.php.cache';
$kernel = new AppKernel('prod', false);
$kernel->loadClassCache();
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);

So logically we have to see 500 error on symfony page instead and not fetal error …

Can it be some bug of symfony 3.4 ? or we are missing something in production configuration ?

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *