Error Connection Postgres Codeigniter

0

I am creating a new connection to connect to a server with codeigniter. here database.php

$db['newdb'] = array(
    'dsn'   => 'pgsql:host=192.xxx.x.xxx;port=5432;dbname=namedb',
    'hostname' => 'localhost',
    'username' => 'user',
    'password' => 'pass',
    'database' => 'namedb',
    'dbdriver' => 'postgre',
    '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
);

Model

<?php
class Model extends CI_Model {

 private $db_b;

 function __construct(){
  $this->db_b = $this->load->database('newdb', TRUE);
 }


 public function getdata()
 {

   $this->db_b->order_by('id', 'asc');
   $query = $this->db_b->get('table');
   if ($query->num_rows() > 0) {
     return $query->result();
   } else {
     return false;
   }
 }
}

I get the following error:

An uncaught Exception was encountered

Type: Error

Message: Call to undefined function pg_connect()

Filename: /var/www/html/test/system/database/drivers/postgre/postgre_driver.php

Line Number: 154

Backtrace:

File: /var/www/html/test/application/models/Model.php
Line: 7
Function: database

File: /var/www/html/test/application/controllers/Class.php
Line: 18
Function: model

File: /var/www/html/test/index.php
Line: 315
Function: require_once

I'm using Linux Mint

    
asked by MoteCL 21.06.2018 в 21:45
source

0 answers