我正在嘗試使用Codeigniter框架連接到PostgreSQL。 現在在我的database.php中如何連接到Codeigniter 3中的POSTGRESQL?
我有以下代碼:
$active_group = 'default';
$query_builder = TRUE;
$db['default'] = array(
'dsn' => '',
'hostname' => 'localhost',
'username' => 'postgres',
'password' => '',
'database' => 'fmsdb',
'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
);
但是當我在本地主機上運行我的地盤,我獲得以下數據庫錯誤:
一個PHP錯誤遇到了
嚴重性:警告
消息:pg_connect():無法連接到PostgreSQL服務器:could 未連接到服務器:權限被拒絕在主機 「localhost」(:: 1)上運行的服務器是否在端口5432上接受TCP/IP連接?可能 未連接到服務器:權限被拒絕服務器在主機 「localhost」(127.0.0.1)上運行並且接受端口5432上的TCP/IP連接?
文件名:postgre/postgre_driver.php
行號:154
我試圖把這個在我的postgresql.conf文件:
listen_addresses = '*'
我要去哪裏錯了?
這將幫助:http://stackoverflow.com/questions/29630851/connecting-postgresql-and-codeigniter – devpro
添加PostgreSQL的端口'$ DB [ '默認'] [ '口'] = 5432;也'啓用了PHP ini的分機。 '延長= php_pdo_pgsql。dll' – devpro
如何在centos7中啓用此擴展功能 – Rajan