I use a password with a special char and symfony return an error "Malformed parameter "url"."
How can i use this kind of password ? foo?bar
I try with variables like that
DATABASE_USER='foo'
DATABASE_PASSWORD='foo?bar'
DATABASE_URL=mysql://${DATABASE_USER}:${DATABASE_PASSWORD}@100.100.100.100:3306/db
But is not working
as the variable name suggests, the DATABASE_URL
has to be a URL. that is, everything that is a character with meaning in URLs (for example #
, ?
, :
, ...) has to be URL-encoded.
For example ?
has to be encoded as %3F
if it is supposed to appear in a different meaning than to mark the query. There are lots of tools online to URL-encode stuff...
Use password urlencoded through urlencode()
or online:
(e.g: ZZ?*?daWm => ZZ%3F%2A%3FdaWm
Full database url param should like:
DATABASE_URL=mysql://test_user:ZZ%3F%2A%[email protected]:3306/test_db
And then go to ./app/config/packages/doctrine.yaml
I had url parameter with resolve prefix:
doctrine:
dbal:
# (....)
url: '%env(resolve:DATABASE_URL)%'
Simply remove the prefix 'resolve' which fixed the problem, After changes:
doctrine:
dbal:
# (....)
url: '%env(DATABASE_URL)%'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With