在Laravel PHP Framework中找不到PGSQL驱动程序


PGSQL driver not found in Laravel PHP Framework

嗨,我在CentOS 6.3上使用Laravel PHP框架。我安装了PostgreSQL 9.1,以及PDO和PDO-PGSQL。在application/config/database.php下,我已经将Laravel设置为使用PostgreSQL:

'default' => 'pgsql',

'connections' => array(
    'pgsql' => array(
        'driver'   => 'pgsql',
        'host'     => 'localhost',
        'database' => 'dbname',
        'username' => 'username',
        'password' => 'shhhpass',
        'charset'  => 'utf8',
        'prefix'   => '',
        'schema'   => 'public',
    ),
),

然而,访问任何页面都会给我错误:

Message:
could not find driver
Location:     
/home/dev/public_html/laravel/database/connectors/postgres.php on line 37

有什么想法吗?谢谢

在您的终端上运行sudo apt-get install php5-pgsql

换句话说,安装用于PHP的PostgreSQL驱动程序。

给出错误的行是:

$connection = new PDO($dsn, $username, $password, $this->options($config));

它正在尝试加载pg.的PDO驱动程序

您检查过PHP配置文件中是否启用了pdo扩展吗?检查/etc/php.d/pgsql.ini/etc/php.d/pdo.ini

希望这能有所帮助。