codeigniter与postgresql数据库的连接
代码为connect,但数据库组无效,即由于database.php文件中的设置无效,代码未与数据库连接。 我们在哪里查找错误以及如何解决此问题codeigniter与postgresql数据库的连接,postgresql,codeigniter,Postgresql,Codeigniter,代码为connect,但数据库组无效,即由于database.php文件中的设置无效,代码未与数据库连接。 我们在哪里查找错误以及如何解决此问题 You have specified an invalid database connection group (db) in your config/database.php file. 此文件显示错误,但未指定为where is error config/database.php code below: $db['default'] = a
You have specified an invalid database connection group (db) in your config/database.php file.
此文件显示错误,但未指定为where is error
config/database.php code below:
$db['default'] = array(
'dsn' => 'pgsql:host=localhost;port=5432;dbname=success_story',
'hostname' => 'localhost',
'username' => 'puneetchhabra',
'password' => 'shambhu',
'database' => 'success_story',
'dbdriver' => 'mysqli',
'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文件代码显示了似乎是什么错误
浏览器出现此错误,无法连接
Message: pg_connect(): Unable to connect to PostgreSQL server: missing "=" `after "localhost" in connection info string`
友善地提出建议
谢谢。试试这个
$db['default'] = array(
'dsn' => 'localhost',
'hostname' => 'localhost',
'username' => 'puneetchhabra',
'password' => 'shambhu',
'database' => 'success_story',
'dbdriver' => 'postgre', # or PDO
'port' => '' #ex 5433
);
确定
php_-pdo_-pgsql
(用于pdo)和php_-pgsql
(用于postgre)您的
$active\u组是什么?在database.php中,您应该声明$active\u group='default'代码>$active_group='default'
已经codedi不这么认为-因为Codeigniter告诉您它是$active\u group='db'代码>(根据你的错误信息)它的代码我没有完全理解你的意思,而不是'default'
我写'db'
。这就是你的意思吗?错误仍然存在,我将更新php.ini并启用扩展重新启动xamp/lamphallo,因此下面扩展的代码是enable;conf/php.ini。问题存在于何处?因此我将其缩小为错误:消息:pg_connect():无法连接到PostgreSQL server:连接信息字符串中“localhost”后缺少“=”