From ffb7e86641979a45bc9d594e930854562374013a Mon Sep 17 00:00:00 2001 From: Stephen Cuppett Date: Sat, 15 Nov 2014 15:10:55 -0500 Subject: [PATCH] Enable sslmode for PostgreSQL connections By default, PHP 5.5 and PostgreSQL PDO will not allow SSL connections. This adds the default of "allow", but also the user may override the setting to "require" or any of the other potential values. See: http://php.net/manual/en/function.pg-connect.php --- lib/Cake/Model/Datasource/Database/Postgres.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Cake/Model/Datasource/Database/Postgres.php b/lib/Cake/Model/Datasource/Database/Postgres.php index bc2e3e075..20e654202 100644 --- a/lib/Cake/Model/Datasource/Database/Postgres.php +++ b/lib/Cake/Model/Datasource/Database/Postgres.php @@ -46,6 +46,7 @@ class Postgres extends DboSource { 'schema' => 'public', 'port' => 5432, 'encoding' => '', + 'sslmode' => 'allow', 'flags' => array() ); @@ -118,7 +119,7 @@ class Postgres extends DboSource { try { $this->_connection = new PDO( - "pgsql:host={$config['host']};port={$config['port']};dbname={$config['database']}", + "pgsql:host={$config['host']};port={$config['port']};dbname={$config['database']};sslmode={$config['sslmode']}", $config['login'], $config['password'], $flags