【发布时间】:2019-08-26 08:47:13
【问题描述】:
我有一个带有 postgre 数据库连接的 codeigniter 项目。它在浏览器中运行良好,但在 CLI 中却不行。
这是我的 Codeigniter 数据库连接:
$db['default'] = array(
'dsn' => '',
'hostname' => 'localhost',
'username' => 'postgres',
'password' => 'password',
'database' => 'my_db',
'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
);
当我在 CLI 中运行 Codeigniter 时,它说:
An uncaught Exception was encountered
Type: Error
Message: Call to undefined function pg_connect()
Filename: F:\xampp\htdocs\crawls\system\database\drivers\postgre\postgre_driver.php
Line Number: 154
Backtrace:
File: F:\xampp\htdocs\crawls\application\controllers\Playground.php
Line: 9
Function: __construct
File: F:\xampp\htdocs\crawls\index.php
Line: 315
Function: require_once
这是我通过 CLI 运行它的命令:
php index.php playground test
我应该解决什么问题?所以我可以通过 CLI 使用 Postgre DB 运行 Codeigniter
我在 PHP 5.6.12 上使用 XAMPP 和 Windows 机器运行它
【问题讨论】:
标签: php postgresql codeigniter command-line-interface