【发布时间】:2019-10-09 07:27:43
【问题描述】:
代码是为连接编写的,但函数 pg_connect() 不适用于框架和数据库,即 codeigniter 和 postgreSQL。
为了连接数据库,我为 config/database.php 编写了代码 但错误是持久的,连接无法连接。
我完成了 config/database.php 文件的信息 详细信息是完整的,并根据数据库连接的要求提供。
$active_group = 'default';
$query_builder = TRUE;
$db['default'] = array(
'dsn' => 'localhost',
'hostname' => 'localhost',
'username' => 'puneetchhabra',
'password' => 'shambhu',
'database' => 'success_story',
'dbdriver' => 'postgre',
'port' => '',
'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
);
错误信息
严重性:警告
消息:pg_connect():无法连接到 PostgreSQL 服务器:丢失 连接信息字符串中“localhost”之后的“=”
文件名:postgre/postgre_driver.php
行号:154
无法使用提供的设置连接到您的数据库服务器。
文件名:core/CodeIgniter.php
行号:518
【问题讨论】:
-
基于this qa,如果您拨打了此类电话,请尝试使用
pg_pconnect()。也尝试empty the dsn。你可以尝试很多,只需keep searching。
标签: php postgresql codeigniter