I use Symfony 3.1.5 and I am trying to run a simple
php bin/console doctrine:database:create
as it is described in the documentation.
My parameters.yml
parameters:
database_host: hhvm_db_1
database_port: 5432
database_name: dbname
database_user: dbuser
database_password: mypassword
My config.yml
doctrine:
dbal:
driver: pdo_pgsql
host: "%database_host%"
port: "%database_port%"
dbname: "%database_name%"
user: "%database_user%"
password: "%database_password%"
charset: UTF8
I get the following error messages:
[Doctrine\DBAL\Exception\DriverException]
An exception occured in driver: [32681]: could not translate host name "hhvm_db_1
port=5432 dbname=postgres " to address: Name or service not known
[Doctrine\DBAL\Driver\PDOException]
[32681]: could not translate host name "hhvm_db_1 port=5432 dbname=postgres " to a
ddress: Name or service not known
[PDOException]
[32681]: could not translate host name "hhvm_db_1 port=5432 dbname=postgres " to a
ddress: Name or service not known
The error message looks odd to me, because it states dbname=postgres while I have a different database specified in my parameters.yml. I tried to change it directly in the config.yml, but that does not change a thing. Database host and port are taken from my parameters.yml though.
I suppose doctrine is just using default parameters for dbname, as it cannot parse my parameters for some reason. What could be the problem here?
I don't think this is really the issue, but I am running symfony in a docker container with hhvm. hhvm_db_1 in the above error message is the second container running Postgres. When I check the connection with vanilla PHP it works and I can connect to the database. Thus, the host is accessible from my web container.
parameters.ymland the config files for the different environments (test, dev, prod). None of them holds an additional database configuration. But that was why I asked for a way to debug the console script.-vvvwill increase the logging to the maximum level, which could help with debugging.