title: Yii2 impossible to connect to postgresql
body: <p>I get this error when i'am using yii2 with a postgresql database.</p>
  
  <pre><code>SQLSTATE[HY000] [2002] No such file or directory
  
  Caused by: PDOException
  
  SQLSTATE[HY000] [2002] No such file or directory
  </code></pre>
  
  <p>I configured the file main-local.php like this : </p>
  
  <pre><code>&lt;?php
  return [
      'components' =&gt; [
          'db' =&gt; [
              'class' =&gt; 'yii\db\Connection',
              'dsn' =&gt; 'pgsql:host=127.0.0.1;port=5432;dbname=dbname',
              'username' =&gt; 'user',
              'password' =&gt; 'pass',
              'charset' =&gt; 'utf8',
          ],
          'mailer' =&gt; [
              'class' =&gt; 'yii\swiftmailer\Mailer',
              'viewPath' =&gt; '@common/mail',
              // send all mails to a file by default. You have to set
              // 'useFileTransport' to false and configure a transport
              // for the mailer to send real emails.
              'useFileTransport' =&gt; true,
          ],
      ],
  ];
  </code></pre>
  
  <p>By the way when i use mysql it's working .</p>