Skip to content
Advertisement

disable symfony 5 database connection

I have the default config in my symfonu project I have this line at .env file

DATABASE_URL="postgresql://db_user:db_password@127.0.0.1:5432/db_name?serverVersion=13&charset=utf8"

and I get this error

An exception occurred in 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 5432?

Of course I dont have not isntalled postgres, and I dont need a database for this project, How I cant fix this error I tried to comment the .env file line but I get another error

Advertisement

Answer

Commenting the line as L3xpert answer suggests doesn’t seem to do the job.
It will throw the error :
Environment variable not found: “DATABASE_URL”.

If you don’t need Doctrine but you have Website-Skeleton installed, you can remove Doctrine by running this command :

composer remove doctrine/doctrine-bundle doctrine/doctrine-migrations-bundle
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement