Symfony 4, Postgres - `Invalid value for parameter "client_encoding": "utf8mb4"` on running doctrine command
So my actual client config in the postgres is utf8
not utf8mb4
. It seems symfony does not automatically detects the version and database for us.
Symfony 4
has left the standard utf8mb4
for MYSQL
in the config file config/packages/doctrine.yaml
. This configuration file should not be forgotten to change based on these allowed configuration. So the problem was fixed when I changed the value
from
dbal:
driver: 'pdo_mysql'
server_version: '5.7'
charset: utf8mb4
default_table_options:
charset: utf8mb4
collate: utf8mb4_unicode_ci
to
dbal:
driver: 'pdo_postgresql'
server_version: '10.5'
charset: utf8
default_table_options:
charset: utf8
collate: utf8_unicode_ci
For me it helped to add the encoding to the Database URL, like this:
postgres://api-platform:!ChangeMe!@db/api?charset=UTF-8
Though this problem only occurred in APP_ENV=prod
.