简体   繁体   English

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

[英]PGSQL driver not found in Laravel PHP Framework

Hi I am using Laravel PHP framework on CentOS 6.3. 嗨,我在CentOS 6.3上使用Laravel PHP框架。 I have PostgreSQL 9.1 installed, along with PDO and PDO-PGSQL. 我安装了PostgreSQL 9.1,以及PDO和PDO-PGSQL。 Under application/config/database.php I have set Laravel to use PostgreSQL: 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',
    ),
),

However, visiting any page gives me the error: 但是,访问任何页面都会给我错误:

Message:

could not find driver
Location:     

/home/dev/public_html/laravel/database/connectors/postgres.php on line 37

Any ideas? 有任何想法吗? Thanks! 谢谢!

The line giving that error is this: 给出该错误的行是这样的:

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

It is trying to load the PDO driver for pg. 它正在尝试为pg加载PDO驱动程序。

Did you check that the pdo extension is enabled in PHP configuration files? 您是否检查了PHP配置文件中是否启用了pdo扩展名? Check the /etc/php.d/pgsql.ini and /etc/php.d/pdo.ini . 检查/etc/php.d/pgsql.ini/etc/php.d/pdo.ini

Hope this helps. 希望这可以帮助。

Run sudo apt-get install php5-pgsql on your terminal. 在终端上运行sudo apt-get install php5-pgsql

In other words, install the PostgreSQL driver for PHP. 换句话说,安装用于PHP的PostgreSQL驱动程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM