title: Symfony/Doctrine: How to make Doctrine working with Unix socket?
body: <p>I'm trying to connect to PostgreSQL using Unix socket. It's I think only one way to connect to database which is on host, but the application is in Docker (I follow the principle to not containerize not replicated database). I'm using Symfony 4 with latest Doctrine.</p>
  <p>I made a test on raw PHP with PDO, and it works. I don't have idea how to enforce Doctrine to use unix socket.</p>
  <pre><code>&lt;?php
  $dbh = new PDO('pgsql:host=/var/run/postgresql;user=xxxx;dbname=zzzz;password=yyyy');
  $dbh-&gt;setAttribute(PDO::ERRMODE_EXCEPTION, true);
  var_dump($dbh-&gt;errorInfo());
  
  $stmt = $dbh-&gt;query('SELECT 1 as dupa;');
  $stmt-&gt;execute();
  
  var_dump($stmt-&gt;fetchAll());
  </code></pre>
  <p>And the result of it is as expected:</p>
  <pre><code>www-data@ef0f2269b69a:~/html$ php o.php 
  array(3) {
    [0]=&gt;
    string(5) &quot;00000&quot;
    [1]=&gt;
    NULL
    [2]=&gt;
    NULL
  }
  array(1) {
    [0]=&gt;
    array(2) {
      [&quot;dupa&quot;]=&gt;
      int(1)
      [0]=&gt;
      int(1)
    }
  }
  </code></pre>
  <p>The problem is whatever I configure in Doctrine I get this:</p>
  <pre><code>In PDOConnection.php line 27:
                                                                          
    [PDOException (7)]                                                    
    SQLSTATE[08006] [7] could not connect to server: Connection refused   
          Is the server running on host &quot;localhost&quot; (127.0.0.1) and accepting  
          TCP/IP connections on port 5432?                                     
    could not connect to server: Cannot assign requested address          
          Is the server running on host &quot;localhost&quot; (::1) and accepting        
          TCP/IP connections on port 5432?    
  </code></pre>
  <p>I tried Doctrine's syntax, raw PDO syntax, do not have idea.
  Is there a possibility that my pdo_pgsql does not have unix socket support compiled?</p>
  <p>This is what I tried as database URL in Doctrine:</p>
  <pre><code>pdo-pgsql://yyyy:xxxxx@/var/run/postgresql:5432/zzzzz
  pgsql:host=/var/run/postgresql;user=xxxx;dbname=zzzz;password=yyyy
  </code></pre>