我正在玩Kohana Framework,我在第一步就被困住了:
我想在PostgreSQL中使用它,但我在Kohana中遇到错误:
ErrorException [ Fatal Error ]: Class 'Database_Pgsql' not found
MODPATH/database/classes/kohana/database.php [ 78 ]
73
74 // Set the driver class name
75 $driver = 'Database_'.ucfirst($config['type']);
76
77 // Create the database connection instance
78 new $driver($name, $config);
79 }
80
81 return Database::$instances[$name];
82 }
83
{PHP internal call} » Kohana_Core::shutdown_handler()
这是我的database.php文件
<?php defined('SYSPATH') or die('No direct access allowed.');
return array
(
'default' => array
(
'type' => 'pgsql',
'connection' => array(
'dsn' => 'pgsql:host=localhost;dbname=globalgest',
'hostname' => 'localhost',
'database' => 'globalgest',
'username' => 'postgres',
'password' => 'xxxxxxx',
'persistent' => FALSE,
),
'table_prefix' => '',
'charset' => 'utf8',
'caching' => FALSE,
'profiling' => TRUE,
),
);
在php ini中,我可以看到正确安装了postgrsql驱动程序:
pgsql
PostgreSQL Support enabled
PostgreSQL(libpq) Version 9.0.5
Multibyte character support enabled
SSL support enabled
Active Persistent Links 0
Active Links 0
我还缺少什么?
谢谢!
答案 0 :(得分:2)
配置中的数据库'type'不应该是'pgsql'而是'pdo'。
答案 1 :(得分:2)
或使用本机postgres驱动程序:https://github.com/cbandy/kohana-postgresql