0

I'm new to symfony and im following the book with heroku as host, im trying to flush a object to database with doctrine but im getting the following error:

[2015-08-04 05:23:58] request.CRITICAL: Uncaught PHP Exception PDOException: "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?" at /app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php line 40 {"exception":"[object] (PDOException(code: 7): SQLSTATE[08006] [7] could not connect to server: Connection refused\n\tIs the server running on host \"127.0.0.1\" and accepting\n\tTCP/IP connections on port 5432? at /app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:40)"} []

I got my configuration files working (i guess):

 parameters.yml
 database_host: host....
 database_port: 5432
 database_name: ddas1mq8intjqt
 database_user: ymmpjzoqbyokbr
 database_password: password.....
 mailer_transport: smtp
 mailer_host: 127.0.0.1
 mailer_user: null
 mailer_password: null
 secret: ThisTokenIsNotSoSecretChangeIt

and my config.yml:

doctrine:
    dbal:
        driver:   pdo_pgsql
        host:     "%database_host%"
        port:     "%database_port%"
        dbname:   "%database_name%"
        user:     "%database_user%"
        password: "%database_password%"
        charset:  UTF8

I've run the console commands to create the tables from the entity classes and it worked, but creating an object and ->flush seems the problem... don't know if its some server configuration or I've done something wrong.

Thank you

1
  • that's weird. have you tried droping all your tables and recreating them using doctrine commands? Just to be sure nothing has changed on the server configuration. Commented Aug 4, 2015 at 7:48

1 Answer 1

2

If console command worked, it might be caused by application cache, especially if you run it in prod environment and you have changed database credentials recently. Try to clear the cache for environment you are using (first command for dev, second for prod) and run application again.

php app/console cache:clear
php app/console cache:clear -e prod

I see in error message you used '127.0.0.1', have you tried to type 'localhost' instead? I have similar issue on shared webhosting.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.