D
D
Denis2021-12-27 14:54:05
PostgreSQL
Denis, 2021-12-27 14:54:05

Why can't I get data from the database?

I'm getting acquainted with the symphony and I can't understand one thing.
Launched symfony nginx php postgres project in docker.
Rolled into the migration database and fake data from the console (there were no errors about connecting to the database).
I'm trying to get data from the database through the controller and writes

An exception occurred in the driver: SQLSTATE[08006] [7] could not connect to server: Connection refused
Is the server running on host "127.0.0.1" and accepting
TCP/IP connections on port 15432?


env file
DATABASE_URL="postgresql://user:[email protected]:15432/db?serverVersion=12&charset=utf8


doctrine.yml file
doctrine:
    dbal:
        url: '%env(resolve:DATABASE_URL)%'

        # IMPORTANT: You MUST configure your server version,
        # either here or in the DATABASE_URL env var (see .env file)
        #server_version: '13'
        driver: pdo_pgsql
        server_version: '12'

I tried to connect to the database in a storm with parameters from the env file, everything works fine and you can see and get it ... through the browser an error.
What's wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis, 2021-12-27
@Drumsid

Yes, I figured it out)) it was necessary to make a connection like this

DATABASE_URL="postgresql://user:[email protected]/db?serverVersion=12&charset=utf8

and then all is well...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question