Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
codeigniter与postgresql数据库的连接_Postgresql_Codeigniter - Fatal编程技术网

codeigniter与postgresql数据库的连接

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

代码为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'] = 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.ini中,启用扩展
    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”后缺少“=”