title: Unable to connect to PostgreSQL from CakePHP
body: <p>I'm getting errors in my PHP when I try and connect to a postgres datasource.</p>
  
  <pre><code>&gt; Error: Database connection "Postgres" is missing, or could not be created.
  #0 /var/www/html/api/lib/Cake/Model/ConnectionManager.php(105): DboSource-&gt;__construct(Array)
  #1 /var/www/html/api/lib/Cake/Model/Model.php(3482): ConnectionManager::getDataSource('nuvi')
  #2 /var/www/html/api/lib/Cake/Model/Model.php(1128): Model-&gt;setDataSource('nuvi')
  #3 /var/www/html/api/lib/Cake/Model/Model.php(3504): Model-&gt;setSource('reports')
  #4 /var/www/html/api/lib/Cake/Model/Model.php(3311): Model-&gt;getDataSource()
  #5 /var/www/html/api/app/Model/NuviReport.php(1172): Model-&gt;query('SELECT `rtg`.`m...')
  #6 /var/www/html/api/app/Model/NuviReport.php(911): NuviReport-&gt;setMetrics('4778')
  #7 /var/www/html/api/app/Console/Command/ReportsShell.php(42): NuviReport-&gt;setReportMetrics('4778')
  #8 /var/www/html/api/lib/Cake/Console/Shell.php(440): ReportsShell-&gt;main()
  #9 /var/www/html/api/lib/Cake/Console/ShellDispatcher.php(207): Shell-&gt;runCommand(NULL, Array)
  #10 /var/www/html/api/lib/Cake/Console/ShellDispatcher.php(66): ShellDispatcher-&gt;dispatch()
  #11 /var/www/html/api/app/Console/cake.php(36): ShellDispatcher::run(Array)
  </code></pre>
  
  <p>I can connect ok to a MySQL database but get errors  when Im trying to switch to postgres</p>
  
  <p>The output from php -v is</p>
  
  <pre><code>PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20131226/mysqli' - /usr/local/lib/php/extensions/no-debug-non-zts-20131226/mysqli: cannot open shared object file: No such file or directory in Unknown on line 0
  PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20131226/pdo_mysql' - /usr/local/lib/php/extensions/no-debug-non-zts-20131226/pdo_mysql: cannot open shared object file: No such file or directory in Unknown on line 0
  PHP Warning:  PHP Startup: Unable to load dynamic library '/var/lib/php5/modules/registry/pdo_pgsql' - /var/lib/php5/modules/registry/pdo_pgsql: file too short in Unknown on line 0
  PHP Warning:  PHP Startup: Unable to load dynamic library '/var/lib/php5/modules/registry/pgsql' - /var/lib/php5/modules/registry/pgsql: file too short in Unknown on line 0
  PHP 5.6.30 (cli) (built: Mar 21 2017 23:01:57) 
  Copyright (c) 1997-2016 The PHP Group
  Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
  </code></pre>
  
  <p>Ive installed apt-get install php5-pgsql and thats got some of the modules I was missing so my php.ini modules now looks like this</p>
  
  <pre><code>;extension=bz2
  ;extension=curl
  ;extension=fileinfo
  ;extension=gd2
  ;extension=gettext
  ;extension=gmp
  ;extension=intl
  ;extension=imap
  ;extension=interbase
  ;extension=ldap
  ;extension=mbstring
  ;extension=exif      ; Must be after mbstring as it depends on it
  extension=mysqli
  extension=/usr/lib/php5/20131226/mysqli.so
  ;extension=oci8_12c  ; Use with Oracle Database 12c Instant Client
  ;extension=openssl
  ;extension=pdo_firebird
  extension=pdo_mysql
  ;extension=pdo_oci
  ;extension=pdo_odbc
  extension=/var/lib/php5/modules/registry/pdo_pgsql
  ;extension=pdo_sqlite
  extension=/var/lib/php5/modules/registry/pgsql
  ;extension=shmop
  </code></pre>
  
  <p>I'm not seeing anything about postgres in php -i but there is just this </p>
  
  <p>PDO</p>
  
  <p>PDO support => enabled
  PDO drivers => sqlite, mysql</p>