Use a postgres database with symfony3
<p><br> We are retro-engineering a web application using a postgres database. We want to refactor the code using the symfony framework but we are facing a problem to use the database with it. </p>

<p><br> For the moment our project is working with a MySQL database just using the same structure for the used tables. The problem is that, now, we need to use the postgresql database because there is a lot of data and it's not really adapted to MySQL as far as we know.</p>

<p><br>We made a lot of research but we didn't succeed to create a postgresql database in the symfony project. 
<br>First, we tried to apply this tutorial : <a href="http://www.tutodidacte.com/symfony2-utiliser-une-base-de-donnee-postgresql" rel="noreferrer">http://www.tutodidacte.com/symfony2-utiliser-une-base-de-donnee-postgresql</a> we adapted it as much as possible for our project.
Here is our <b> config.yml </b></p>

<pre><code>imports:
    - { resource: parameters.yml }
    - { resource: security.yml }
    - { resource: services.yml }

# Put parameters here that don't need to change on each machine where the app is deployed
#     http://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
parameters:
    locale: en

framework:
    #esi:             ~
    #translator:      { fallbacks: ["%locale%"] }
    secret:          "%secret%"
    router:
        resource: "%kernel.root_dir%/config/routing.yml"
        strict_requirements: ~
    form:            ~
    csrf_protection: ~
    validation:      { enable_annotations: true }
    #serializer:      { enable_annotations: true }
    templating:
        engines: ['twig']
    default_locale:  "%locale%"
    trusted_hosts:   ~
    trusted_proxies: ~
    session:
         #      http://symfony.com/doc/current/reference/configuration/framework.html#handler-id
        handler_id:  session.handler.native_file
        save_path:       "%kernel.root_dir%/../var/sessions/%kernel.environment%"
    fragments:       ~
    http_method_override: true
    assets: ~

# Twig Configuration
twig:
     debug:            "%kernel.debug%"
     strict_variables: "%kernel.debug%"

# Doctrine Configuration
doctrine:
    dbal:
        default_connection: default
        connections:
           #Mysql
           default:
                driver:   pdo_mysql
                host:     "%database_host%"
                port:     "%database_port%"
                dbname:   "%database_name%"
                user:     "%database_user%"
                password: "%database_password%"
                charset:  UTF8
           #Postgresql
           pgsql:
                driver:   pdo_pgsql
                host:     localhost
                port:     5432
                dbname:   "%psql_database_name%"
                user:     root
                password: "%psql_database_password%"
                charset:  UTF8

         #mapping_types:
            #geometry: string

    orm:
        default_entity_manager: default
        auto_generate_proxy_classes: "%kernel.debug%"
        #naming_strategy: doctrine.orm.naming_strategy.underscore
        #auto_mapping: true

        entity_managers:
            default:
                connection: default

                 # lister les Bundles utilisant la connexion par defaut

                 #mappings:
                    #monprojetmysqlBundle:  ~
                    #tutoUserBundle:  ~

            pgsql:
                connection: pgsql    # connection name for your additional DB

                # bundles utilisant la connexion Postgresql
                #mappings:
                    # PostgresqlBundle: ~

# Swiftmailer Configuration
swiftmailer:
    transport: "%mailer_transport%"
    host:      "%mailer_host%"
    username:  "%mailer_user%"
    password:  "%mailer_password%"
    spool:     { type: memory }
</code></pre>

<p>but when we launched this command : <b>php bin/console     doctrine:database:create --connection=pgsql</b> we had this answer :</p>

<pre><code>  [Doctrine\DBAL\Exception\DriverException]              
    An exception occured in driver: could not find driver  



  [Doctrine\DBAL\Driver\PDOException]  
   could not find driver                



  [PDOException]         
   could not find driver  


doctrine:database:create [--connection [CONNECTION]] [--if-not-exists] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] &lt;command&gt;
</code></pre>

<p><br> It seems that we don't have the module <b>pdo_pgsql</b> so we searched how to install it.
<br> To do it, we applied the script proposed on this github page : <a href="https://gist.github.com/doole/8651341#file-install_psql_php-sh" rel="noreferrer">https://gist.github.com/doole/8651341#file-install_psql_php-sh</a> 
<br> We changed the version of postgres.app to 9.5.
After a few tries, we finally succeeded to have <b>pdo_pgsql</b>  on the result of <b>php -m</b>.
<br> But know, we have this answer when we launch the command : <b>php bin/console doctrine:database:create --connection=pgsql</b> </p>

<pre><code>PHP Warning:  PHP Startup: pdo_pgsql: Unable to initialize module
Module compiled with module API=20131226
PHP    compiled with module API=20121212
These options need to match
in Unknown on line 0
PHP Warning:  PHP Startup: pgsql: Unable to initialize module
Module compiled with module API=20131226
PHP    compiled with module API=20121212
These options need to match
 in Unknown on line 0


  [Doctrine\DBAL\Exception\DriverException]              
  An exception occured in driver: could not find driver  



  [Doctrine\DBAL\Driver\PDOException]  
  could not find driver                



  [PDOException]         
   could not find driver  


doctrine:database:create [--connection [CONNECTION]] [--if-not-exists] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] &lt;command&gt;
</code></pre>

<p><br> We tried to do this : <a href="https://stackoverflow.com/questions/29706027/install-php-with-postgresql-on-mac-using-homebrew">Install PHP with Postgresql on MAC using homebrew</a>
but it didn't change anything. Now we have 5 PHP WARNING for pdo_pgsql and pgsql when we launch the command <b>php bin/console doctrine:database:create --connection=pgsql</b>
</p>

<p><br>We have also seen this : 
<a href="https://stackoverflow.com/questions/10588646/how-to-change-a-database-to-postgresql-with-symfony-2-0">How to change a database to postgresql with Symfony 2.0?</a> and this : <a href="https://stackoverflow.com/questions/8440403/how-to-create-2-connections-mysql-and-postgresql-with-doctrine2-in-symfony2">How to create 2 connections (mysql and postgresql) with Doctrine2 in Symfony2</a> but it didn't really help because the first one concern debian and we are working on OS X El Capitan and the second one don't tell more than the previous tutorial.</p>

<p><br> Finally, the only hope we have is that someone can help us...
Thank you in advance.</p>