您好,我正在尝试将 laravel 5.4 与 postgres 连接,更新数据库配置文件并运行 php artisan migrate
后,出现以下错误:
[Illuminate\Database\QueryException]
could not find driver (SQL: select * from information_schema.tables where t
able_schema = public and table_name = migrations)
[PDOException]
could not find driver
这是我的.env
文件
DB_CONNECTION=pgsql
DB_HOST=127.0.0.1
DB_PORT=5432
DB_DATABASE=Portail
DB_USERNAME=php
DB_PASSWORD=php
这是我的database.php
文件
'default' => env('DB_CONNECTION', 'pgsql'),
'pgsql' => [
'driver' => 'pgsql',
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '5432'),
'database' => env('DB_DATABASE', 'Portail'),
'username' => env('DB_USERNAME', 'php'),
'password' => env('DB_PASSWORD', 'php'),
'charset' => 'utf8',
'prefix' => '',
'schema' => 'public',
'sslmode' => 'prefer', ],
我正常使用 phpPgAdmin
最佳答案
sudo apt-get 安装 php-pgsql。这是在linux中安装php pgsql驱动的命令
关于php - 连接 postgres 和 laravel,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43637399/