简体   繁体   English

Laravel - 迁移到 PGSQL 错误

[英]Laravel - Migration to PGSQL error

i started a project with Laravel and PostgreSQL but i can not make the migration.我用 Laravel 和 PostgreSQL 开始了一个项目,但我无法进行迁移。

[Illuminate\Database\QueryException]
could not find drive (SQL: select * from information_schema.tables where table_schema = public and table_name = migrations)

[PDOException]
could not find driver

I checked my php.ini and i've uncomment the lines:我检查了我的 php.ini 并取消了对以下行的注释:

extension=php_pdo_pgsql.dll
extension=php_pgsql.dll

I restarted the server and when i tried again, the console gives me the same error.我重新启动了服务器,当我再次尝试时,控制台给了我同样的错误。 I checked my .env file in laravel and it's okay (i think)我在 laravel 中检查了我的 .env 文件,没问题(我认为)

DB_CONNECTION=pgsql   
DB_HOST=127.0.0.1   
DB_PORT=5432    
DB_DATABASE=laravelPSQL  
DB_USERNAME=postgres    
DB_PASSWORD=password

and also i checked the database.php and it's okay.我还检查了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', 'forge'),
            'username' => env('DB_USERNAME', 'forge'),
            'password' => env('DB_PASSWORD', ''),
            'charset' => 'utf8',
            'prefix' => '',
            'schema' => 'public',
            'sslmode' => 'prefer',
        ]

The last thing i did, was make a file with the function phpinfo() to see if the files of pgsql was enabled and yes.我做的最后一件事是用函数 phpinfo() 创建一个文件,看看 pgsql 的文件是否已启用,是的。

在此处输入图片说明

Honestly i don't know what is happening.老实说,我不知道发生了什么。 I tried in Wamp64, and XAMPP...and nothing.我在 Wamp64 和 XAMPP 中尝试过……什么也没有。 PD. PD。 I using Windows 10我使用的是 Windows 10

I faced the same problem but I solved it by editing my XAMP php.ini file我遇到了同样的问题,但我通过编辑我的 XAMP php.ini文件解决了它

In php.ini file I un-comment this line:php.ini文件中,我取消注释这一行:

extension=pgsql

and then it starts working.然后它开始工作。

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

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