Failure Symfony2 deployment to platform sh. SQLSTATE [HY000] [2002] Failure Symfony2 deployment to platform sh. SQLSTATE [HY000] [2002] symfony symfony

Failure Symfony2 deployment to platform sh. SQLSTATE [HY000] [2002]


I had the same issue because twig was initialized and requested database to know which version of mysql was used. I solved this by adding the following under my doctrine configuration:

doctrine: dbal: [...] charset: UTF8 server_version: 5.6


[Doctrine\DBAL\Exception\ConnectionException]                                    An exception occured in driver: SQLSTATE[HY000] [2002] Connection refused  

Clearly, your app can't connect to database. You can try to replace 127.0.0.1 with localhost but I doubt it will help.

Anyway something is wrong with host you are connecting to: database may be down or absent, IP may be invalid, firewall may block the connection etc.