Search code examples
laravel-5.1heroku-postgres

How to enable postgres on heroku for laravel 5.1


I am not saying this hasn't been asked before, but i am unable to find the answer to this question. So here goes my question. Hope someone can guide me to the right path.

My .env file on Heroku looks something like this.

DB_HOST=postgres://somevalue.compute-1.amazonaws.com:5432
DB_DATABASE=somevalue
DB_USERNAME=secret username
DB_PASSWORD=secret password

When i run php artisan migrate, following is the error.

SQLSTATE[08006] [7] could not translate host name "postgres://somevalue.compute-1.amazonaws.com:5432" to address: Name or service not known 

Solution

  • Remove postgres:// and the port number from DB_HOST, it should be like this

    DB_HOST=somevalue.compute-1.amazonaws.com