0

I am trying to use Symfony 3.0 With a PostreSQL Database.

Parameters.yml:

parameters:
    database_driver: pdo_pgsql
    database_host: 127.0.0.1
    database_port: 5432
    database_name: dmfa
    database_user: username
    database_password: password
    mailer_transport: smtp
    mailer_host: 127.0.0.1
    mailer_user: null
    mailer_password: null
    secret: a28a9e1bfefb5aa6f7f3be73a9a62c01eedf55ab

I run the following code to try and generate and entity:

php ./bin/console doctrine:generate:entity

Despite changing my drive to pdo_pgsql i get the following errors:

[Doctrine\DBAL\Exception\DriverException]                                          
  An exception occured in driver: SQLSTATE[HY000] [2006] MySQL server has gone away 

[Doctrine\DBAL\Driver\PDOException]                
  SQLSTATE[HY000] [2006] MySQL server has gone away

[PDOException]                                     
  SQLSTATE[HY000] [2006] MySQL server has gone away

[PDOException]                                  
  PDO::__construct(): MySQL server has gone away 

It feels like i am missing a step because Symfony is still looking for a mysql database. Please give me some insight on how to correct this error.

1 Answer 1

5

Double check that in your app/config/config.yml you have:

doctrine:
    dbal:
        driver:   "%database_driver%"
Sign up to request clarification or add additional context in comments.

3 Comments

I have corrected that but am not getting the following error [Doctrine\DBAL\Exception\DriverException] An exception occured in driver: could not find driver
That means you probably don't have the driver installed on the machine. You can check the available PDO drivers by doing print_r(PDO::getAvailableDrivers()); in a script.
Thank you that helped. I also had to do the following: brew install php70-pdo-pgsql in case you installed php7 on mac with brew and, change php version according to what you have installed.

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.