Implementing Postgresql with Grocery-Crud Invalid DB Driver Error

176 Views Asked by At

I have a bit of experience with code igniter and grocery crud as I have implemented a working site using MySQLi. But now I'm running into quite a lot of issues trying to set up a site using Postgresql. My database.php config file looks like

$db['default'] = array(
    'dsn' => 'pgsql:host=localhost;dbname=DBNAME',
    'hostname' => 'localhost',
    'username' => 'postgreusername',
    'password' => 'password',
    'database' => 'DBNAME',
    'dbdriver' => 'pdo_pgsql',
    'dbprefix' => '',
    'pconnect' => FALSE,
    'db_debug' => (ENVIRONMENT !== 'production'),
    'cache_on' => FALSE,
    'cachedir' => '',
    'char_set' => 'utf8',
    'dbcollat' => 'utf8_general_ci',
    'swap_pre' => '',
    'encrypt' => FALSE,
    'compress' => FALSE,
    'stricton' => FALSE,
    'failover' => array(),
    'save_queries' => TRUE,
    'port'=> 5432
);

I've also tried using pgsql as the dbdriver, but I keep getting and invalid DB Driver error. I have verified that pgsql and pdo_pgsql are installed and enabled by using

echo get_loaded_extensions();

And both pdo_pgsql and pgsql are listed. Trying to use psql also gives me a DBDriver error, and it makes no difference if the dsn is commented out. Are pdo_pgsql/pgsql the correct dbdrivers to be using to intergrate Postgre with Codeigniter or is there another driver I should look into?

1

There are 1 best solutions below

0
Pedro Perez Pofenas On

Try 'Pdo_Pgsql'. Maybe it's case sensitive...