Postgresql Laravel 5找不到驱动程序Postgre SQL

Postgresql Laravel 5找不到驱动程序Postgre SQL,postgresql,laravel,database-connection,laravel-5,Postgresql,Laravel,Database Connection,Laravel 5,我正在做一个Laravel项目,使用Postgre数据库,我运行 php artisan migrate 然后我得到一个错误 [PDPException] could not find driver 但是我的所有驱动程序都在php.ini中正确安装和启用。我有一个Yii应用程序,使用Postgre,运行良好php_pdo_pgsql已安装并启用 这是我在拉威尔的配置 <?php return [ /* |---------------------------------------

我正在做一个Laravel项目,使用Postgre数据库,我运行

php artisan migrate
然后我得到一个错误

[PDPException] could not find driver
但是我的所有驱动程序都在php.ini中正确安装和启用。我有一个Yii应用程序,使用Postgre,运行良好
php_pdo_pgsql
已安装并启用

这是我在拉威尔的配置

<?php

return [

/*
|--------------------------------------------------------------------------
| PDO Fetch Style
|--------------------------------------------------------------------------
|
| By default, database results will be returned as instances of the PHP
| stdClass object; however, you may desire to retrieve records in an
| array format for simplicity. Here you can tweak the fetch style.
|
*/

'fetch' => PDO::FETCH_CLASS,

/*
|--------------------------------------------------------------------------
| Default Database Connection Name
|--------------------------------------------------------------------------
|
| Here you may specify which of the database connections below you wish
| to use as your default connection for all database work. Of course
| you may use many connections at once using the Database library.
|
*/

'default' => 'pgsql',

/*
|--------------------------------------------------------------------------
| Database Connections
|--------------------------------------------------------------------------
|
| Here are each of the database connections setup for your application.
| Of course, examples of configuring each database platform that is
| supported by Laravel is shown below to make development simple.
|
|
| All database work in Laravel is done through the PHP PDO facilities
| so make sure you have the driver for your particular database of
| choice installed on your machine before you begin development.
|
*/

'connections' => [

    'sqlite' => [
        'driver'   => 'sqlite',
        'database' => storage_path('database.sqlite'),
        'prefix'   => '',
    ],

    'mysql' => [
        'driver'    => 'mysql',
        'host'      => env('DB_HOST', 'localhost'),
        'database'  => env('DB_DATABASE', 'forge'),
        'username'  => env('DB_USERNAME', 'forge'),
        'password'  => env('DB_PASSWORD', ''),
        'charset'   => 'utf8',
        'collation' => 'utf8_unicode_ci',
        'prefix'    => '',
        'strict'    => false,
    ],

    'pgsql' => [
        'driver'   => 'pgsql',
        'host'     => '192.168.3.9',
        'database' => 'qms',
        'username' => 'postgres',
        'password' => 'postgres',
        'charset'  => 'utf8',
        'prefix'   => '',
        'schema'   => 'public',
    ],

    'sqlsrv' => [
        'driver'   => 'sqlsrv',
        'host'     => env('DB_HOST', 'localhost'),
        'database' => env('DB_DATABASE', 'forge'),
        'username' => env('DB_USERNAME', 'forge'),
        'password' => env('DB_PASSWORD', ''),
        'charset'  => 'utf8',
        'prefix'   => '',
    ],

],

/*
|--------------------------------------------------------------------------
| Migration Repository Table
|--------------------------------------------------------------------------
|
| This table keeps track of all the migrations that have already run for
| your application. Using this information, we can determine which of
| the migrations on disk haven't actually been run in the database.
|
*/

'migrations' => 'migrations',

/*
|--------------------------------------------------------------------------
| Redis Databases
|--------------------------------------------------------------------------
|
| Redis is an open source, fast, and advanced key-value store that also
| provides a richer set of commands than a typical key-value systems
| such as APC or Memcached. Laravel makes it easy to dig right in.
|
*/

'redis' => [

    'cluster' => false,

    'default' => [
        'host'     => '127.0.0.1',
        'port'     => 6379,
        'database' => 0,
    ],

],

];

使用postgres需要
条令/dbal

通过要求软件包将其添加到您的应用程序中:


composer require-doctrine/dbal

使用postgres需要
doctrine/dbal
软件包

通过要求软件包将其添加到您的应用程序中:


编写器要求条令/dbal

我也遇到了这个问题。你在用什么操作系统?你解决这个问题了吗?如果是这样的话,你能在这里添加一个答案以便其他人可以从中学习吗?我也有这个问题。你在用什么操作系统?你解决这个问题了吗?如果是这样的话,你能在这里添加一个答案以便其他人可以从中学习吗?你能详细说明为什么需要安装它以及它会产生什么影响吗?我遇到了与上面@Joene相同的问题,添加这个包没有任何效果。如果我没有弄错的话,Elounten使用了doctrine包。安装Laravel后,dbal是可选的。这个包添加了与psql对话所需的必要层。另外,如果这没有帮助的话,我猜你的pdo pgsql的php扩展没有激活。谢谢@Luceos,感谢你提供的信息。令人烦恼的是,我可以通过在PGSQL上运行查询。我的Apache服务器和CLI上都安装了PHP,因此看起来一切都正常工作,只是我的迁移显示了该错误:(你确定雄辩使用了条令,还是它们是彼此的替代品?。在我走得太远之前,有没有任何关于DBAL的官方文档我可以阅读,以确定这是否是我需要的?我们在4.2应用程序中使用psql,并且必须包含用于迁移的条令包,以便在psql上工作。你可能会检查其他建议ted程序包,如果通过您的根编写器文件更改了条令程序包。您确定为php安装了pdo pgsql扩展吗?谢谢@Luceos.Yep,不知为什么我的网站上出现了
pdo_pgsql
但无论我做了什么,都不在我的CLI中。到PostgreS的连接在这两种环境中都是成功的,但Laravel仍然抛出错误。我一直在使用WAMP(主要是因为我对它感到满意),但它已经有一段时间没有更新了,而且时间越来越长了。我切换到了拉拉贡,一切都很顺利。不过,谢谢你迄今为止的帮助。你能详细说明为什么需要安装它,以及它会产生什么效果吗?我遇到了与上面@Joene相同的问题,添加这个软件包没有解决没有任何影响。如果我没有弄错的话,eloquent使用条令包。安装Laravel后,dbal包是可选的。此包添加了eloquent与psql对话所需的必要层。此外,如果这没有帮助,我猜您的pdo pgsql php扩展没有激活。感谢@Luceos,感谢您提供的信息。令人烦恼的是,我可以运行查询n PGSQL via.PHP在我的Apache服务器和CLI上运行,因此看起来一切都正常工作,只是我的迁移显示了该错误:(你确定雄辩使用了条令,还是它们是彼此的替代品?。在我走得太远之前,有没有任何关于DBAL的官方文档我可以阅读,以确定这是否是我需要的?我们在4.2应用程序中使用psql,并且必须包含用于迁移的条令包,以便在psql上工作。你可能会检查其他建议ted程序包,如果通过您的根编写器文件更改了条令程序包。您确定为php安装了pdo pgsql扩展吗?谢谢@Luceos.Yep,不知为什么我的网站上出现了
pdo_pgsql
)但无论我做了什么,都不在我的CLI中。到PostgreS的连接在这两种环境中都是成功的,但Laravel仍然抛出错误。我一直在使用WAMP(主要是因为我对它感到满意),但它已经有一段时间没有更新了,而且时间越来越长了。我换成了拉拉贡,一切都很顺利。不过,谢谢你迄今为止的帮助。