connecting postgresql and codeigniter
Try to set,
dbdriver - The database type. ie: mysql, postgres, odbc, etc. Must be specified in lower case.
More Info: https://www.codeigniter.com/user_guide/database/configuration.html
EDIT: Try this config for PDO
in postgres
$db['default']['hostname'] = 'pgsql:host=localhost;dbname=yourdb'; //set host
$db['default']['username'] = 'your username'; //set username
$db['default']['password'] = 'your password'; //set password
$db['default']['database'] = 'your database'; //set databse
$db['default']['dbdriver'] = 'pdo'; //set driver here
Remove the 'dsn' string and change to 'dbdriver' => 'postgre'
in the config array.
Despite the CI docs stating the value should be 'postgres'
if you check the directory and file names in system>database>drivers
the folder is actually called 'postgre'
, the file name 'postgre_driver.php'
and the class 'CI_DB_postgre_driver'
so we can assume the docs are wrong here. Weird this hasnt raised its ugly head before
I just did it right now. You just leave :
$db['default']['dsn'] = '';
And set:
$db['default']['dbdriver'] = 'postgre';